9. Comments in Javascript)
Q: How can I use JavaScript
Code ?
A: javascript supports three different types of Annotations:
Comments of the multi-line C style. The content included in/* and */is annotated, for example:
/* This is a comment */
/*
I looked at other materials, including CPU extraction and Mac off-the-shelf.
Code But there is no hard disk serial number. After searching for a long time, we can find the parameter for extracting the hard disk serial number. So I made it up.
What is "clone "?
In the actual programming process, we often encounter this situation: there is an object A, which contains some valid values at a time point, in this case, you may need a new object B that is exactly the same as a, and any
I. appending rows to a table
In your past experiences with Ajax, you may use JavaScript to append rows to an existing table, or create a new table containing table rows from the beginning. The document. createelement and document. appendchiid
This document describes the current window or the specified window object. It contains the content of the document from to .
Usage: Document (current window) or . Document (specified window)
Attribute:
Document. Title // set the document title is
This
This indicates the current object. If this is used globally, it indicates the current page Object window. If this is used in the function, this indicates what is called Based on the object on which the function is called at runtime. We can
GlobalObject
Global objects are the most special objects in ecmascript, because they do not exist at all. If you try to write the followingCode, An error is returned:
The error message shows that global is not an object, but didn't Global be
In actual work, I found that
Program The most complained about the script is that it is difficult to debug the script program, especially when debugging wsh programs such as. vbs, always:
1. Double-click a. vbs file in the resource manager.
2. An
To this end, I have collected some JavaScript Functions that I usually use. They are also common in other JS libraries. Now I want to sort them out and add comments for your convenience. I hope they will help you.
Note: assume that all of the
Couplet
CodeTo check its expression in XHTML. The result is very simple. This is because, according to the standard, the scroll bar of the form we see should not be the body, but the HTML (that is, the document.doc umentelement object). Therefore,
Today we will mainly discuss how to encapsulate data in JavaScript scripts ).
Data encapsulation simply hides content that the caller does not want to see. It is object-oriented
Program The first three elements of the design are inheritance and
Check the Code:
HTML:
Copy codeThe Code is as follows:
index
1
2
3
4
Index. js content:Copy codeThe Code is as follows :/*Author: binarytree*/// Fill in the local reference of the imageExt. BLANK_IMAGE_URL =
1) describes the eval function usage in javascript.
(2) how to execute global code in the function
►First, let's talk about eval usage. The content is relatively simple and you can skip it if you are familiar with it.The eval function receives a
The following describes how to write JavaScript code in three different places. To achieve this, click the button to bring up the alert warning box.
The first is the most common. The Code is as follows:Html codeJs CodeFunction pop (){Alert
I vaguely remembered the ins and outs and cheered for my own experience.
I vaguely remember the feeling of helplessness and determination after I was tortured by this same problem for countless times.
First of all, I must thank those who have
Convert to Boolean type
All values in JavaScript can be implicitly converted to the Boolean type, for example:
Copy codeThe Code is as follows: 0 = false; // true 1 = true; // true ''= false // true null = false // true
However, these values are not
The result is as follows: When you click a question, the following reply content is displayed.
Copy codeThe Code is as follows: script type = "text/javascript">
Onload = function (){
Faq (document. getElementsByTagName ("dl") [0], "dt", "dd ");
/*
*
Javascript is no exception, but have you considered object reference? The common practice is a series of object sharing class methods, instead of copying a function for each object. The following describes how to copy a function for each
1. check whether there is an Item with Value = "paraValue" in the select option.
2. add an Item to the select option
3. delete an Item from the select option
4. Delete the selected items in the select statement.
5. In the select option, set the text
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service