<Html>
<Head>
<Meta HTTP-Equiv="Content-type"Content="text/html;charset=gb2312">
<Title>Document.writeln () method</Title>
<Script language="Javascript">
functionCreatesummary ()
{
Win2=Open"","Window2")
//Win2.document.open ("Text/plain")
Win2.document.writeln ("Title"+Document.title)
Win2.document.close ()
}
</Script>
</Head>
body a name
= " #top " ></ a
form Input type = " button " name = ' help ' value = ' help ' OnClick = createsummary () ""
</ form
"" </
HTML
Tell me about the essentials of knowledge:
1:javascript is a case-sensitive language.
2: It is recommended to use '; ' for each writing line.
3: The name of the first letter must be a letter, underscore or ' $ ';
4: Declare the variable in JavaScript with Var, and it is permanent;
5: There is no block-level scope. For example:
Var scope="globle";
function F () {
alert (scope); // show "underfined" instead of "globle"
Var scope="local";
alert (scope);
}
F ();
Same meaning as the following code instance
Var scope="globle";
function f () {
Var scope;
alert (scope); // show "underfined" instead of "globle"
Var scope="local";
alert (scope);
}
F ();
Recommendation: It is a good programming practice to put all the variable declarations together and place them at the beginning of the function.
The 6:ecmascript standard stipulates that functions cannot be overloaded, such as
function Doadd (i) {
alert (i);
}
function Doadd (i) {
alert (i);
}
Doadd (ten);
What really executes is the latter function, and the second one overrides the first function;
The use of 7:arguments objects.
function Doadd ()
If (arguments.length= =1) {
Alert (arguments[0]+);
}
If (arguments.length= =2) {
Alert (arguments[0]+arguments[0);
}
Doadd (ten);
Doadd (a);
Operation effect: Slightly ...
Current 1/3 page
123 Next read the full text