JavaScript ?? ????
JavaScript ?? ????
JavaScript ??? ????? ???? ???(?, ????? ???? ??? ??? ? ??), ???? ???? ?? ????? ??? ??? ?? ????.
?? ???? name ? age ????? hello() ??? ???? ???? ?? ?? Xiaoming ? 18???.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <script type="text/javascript"> function hello(name,age){ document.write("我叫" + name + ",今年" + age + "歲!"); } </script> </head> <body> <input type="button" onclick="hello('小明',18)" value="確定" /> </body> </html>
JavaScript ?? ???? ??
JavaScript ?? ????? ?? ????? ?? ?????? ?? ????? ??? ?????? ???? ???? ????. ??? ???? ????? ??? ??? ??? ? ????? ??? ???? ????.
??? ???? ?? ????? ???? ?? ??(???? ?? ????)? ???? JavaScript ??? ????? ???? ????.
????? ?????? ???? ???? ?? ?? ?? ???? ?? ???? ?? ??? ???? ?? ?? ?? JavaScript ??? ?? ????? ?????.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <script type="text/javascript"> function hello(name,age){ document.write("我叫" + name + ",今年" + age + "歲!"); } </script> </head> <body> <input type="button" onclick="hello('小明')" value="確定" /> </body> </html>
JavaScript ?? ??
JavaScript ???? ?? ?? ??? ????? ??? ?? ???? ???? ?? ?? ??? ????. ??? ???? ?? ???? ??? ???? ??? ?? ????? ?? ???? ? ????.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <script type="text/javascript"> function hello(){ document.write("我叫" + arguments[0] + ",今年" + arguments[1] + "歲!"); } </script> </head> <body> <input type="button" onclick="hello('小明',18)" value="確定" /> </body> </html>
arguments ????args[0]? ? ?? ????? ????,args[1]? ? ?? ????? ???? ????.
?:
????? ?? ????? ?? ???? ??? ?? ????? ?? ??? ???? ????. ??? ?? ????? ????? ?? ????? ?????? ? ?? ??? ???? ??? ? ????.
???? ?? ??
?? ??? ???? ??? ???? ??? ?? ??? ? ????. ??? ?? ??, ? ??.??? ????? ????:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <script type="text/javascript"> function hello(){ document.write(arguments.length); } </script> </head> <body> <input type="button" onclick="hello('小明',18)" value="確定" /> </html>
1. Js ???
function writeNString(strMsg){
document? ?? ??? ????? ??? ? ????. .write( strMsg + "<br>");
}
2. Js ??? ?? ??? ??? ? ????. ????? ???? ????
? ?? ?? ?? ??? ???? ? ?????.function one2N(intnumber){
var intTotal = 0;
for(var i=0;i<=intnumber;i++){
intTotal +=i;}
return intTotal;
}
3. Js ??? ? ?? ? ?? ?? ????
??? ??: ??? ?? ??? ????? ?? ??? ??? ?? ???? ?????. ???? ???? ?? ??? ?? ???? ????.
?? ??: ??? ??? ??? ??? ??? ??? ?????, ?? ??? ????? ?? ???? ?? ????? ?? ??? ?????.
??, ??? ? ??----??? ??
??, ?? ? ??----??? ??
??? ??----??? ??
4. Js ??? ???? ??
Js ???? ?? ?? ???? ?? Arguments Array ??? ????. ????? ???? ?? ??? ??? ?, ??? ???? ??? ???? ???? ???? ?? ??? ???? ???? ??? ?? ???? ?? ?? ? ????. OnFunction Suminteger () {
var Total = 0;
for (var I = 0; I & LT; Suminteger.arguments.Length; I ++) {
Total+= Suminteger.arguments [ i];
}
return total;
}
//?? ??
inntotal = sumInteger(100,45,56 7,234);
??. write(" Function sumInteger(100,45,567,234):"+inttotal+"<br>");
5. JS ??? ?? ??
JS ???? ? ?? ??? ??? ????.?? ??(local Variables) ?? ??? ??? ??? ?? ?? ???? ?? ???? ??? ? ??? ?? ??? ???? ??? ? ??? ???? ? ????. ?? ??? ?? ???? ??? ?????. ? ??? ?? JS ????? ?? ? ???? ???? ???? ? ????.