һЩjavascriptÌâÄ¿
ȺÀïÌÖÂÛ¹ýµÄÌâÄ¿£¬·ÖÏíһϡ£
function test(){
var m=n=1;
alert(m);
}
alert(n);
//ÒòΪtestº¯ÊýûÓÐÖ´ÐУ¬³Ì¶È¿ØÖÆÁ÷²»ÄܽøÈë½øÐнâÎö£¬ÀïÃæµÄ¶«Î÷¶ÔÍâÃæ²»¿É¼û£¬Òò´Ë±¨´í
function test(){
var m=n=1;
alert(m);
}
test();
alert(n);
//µ±testÖ´Ðкó£¬Í³Í³±ä³ÉÈ«¾Ö±äÁ¿
function test() {
return 1
+2
}
alert(test())
ÀàËƵĻ¹ÓУ¬ÓÉȺÀïµÄabcdÌṩ
function test() {
return 1
2
}
alert(test())
ÀàËƵĻ¹ÓУ¬ÓÉȺÀïµÄabcdÌṩ
function test() {
return
2
}
alert(test())
ÀàËƵĻ¹ÓУ¬ÓÉȺÀïµÄabcdÌṩ
function test() {
1
+2-
3
}
alert(test())
//¿¼²ìJavaScriptµÄEOS£¨·ÖºÅ£©ÎÊÌ⣬עÒâ²Ù×÷·ûÊÇ·ñ´æÔÚ
ÉÏÃæÕâÌâÒ²¿ÉÒÔÒý³öÕâôһÌ⣬ÓÉȺÀïµÄabcdÌṩ
function test() {
try {
return 1;
} finally {
return 2;
}
}
alert(test())
//Ò»¸öº¯ÊýÖ´Ðкó±Ø¶¨·µ»Ø£¨return£©Ò»¸ö½á¹û£¬Èç¹ûÔº¯ÊýÌåûÓÐreturnÓï¾ä±Ø·µ»Øundefined¡£
//Èç¹ûÀïÃæ´æÔÚÒì³£´¦Àí£¬finally¿éÖеÄreturn µÄÓÅÏȼ¶¸ßÓÚtry ¿éÖеÄreturn
alert(Number())
ÀàËƵĻ¹ÓУ¬ÓÉȺÀïµÄabcdÌṩ
alert(+" 3 ")
//²Î¼ûECMA3-5thµÄµÚ9.3½ÚÓë15.7.1½Ú¡£Èç¹ûNumber([value])µÄvalue²»´æÔÚ£¬Ôò·µ»Ø0
//Ò»¸ö×Ö·û´®±»Ö´ÐÐÁË¡°+¡±£¬¡°-¡±µÈ²Ù×÷£¬Ï൱ÓÚµ÷ÓÃÁËNumber(str)£¬ÕâʱÒ༴Ï൱ÓÚµ÷ÓÃÁËtoNumberº¯Êý
//ÕâÊÇÒ»¸öÄÚ½¨º¯Êý£¬Ö»´æÔÚÓÚJSÒýÇæÖУ¬¶ÔÓÚÕâ¸östrËü»áÖ´ÐÐtrim²Ù×÷£¬ÔÙÖ´ÐÐÊý×Öת»»£¬
//Èç¹ûÄÜת»»»ù±¾ÉÏת»»ÎªÊ®½øÖÆ(Èç0x12תΪ18)£¬Èç¹ûÊý×Ö¹ý´ó»áʹÓÃÖ¸Êý£¬
//Èç¹ûtrimºóµÃµ½µÄΪInfinity£¬ÔòÖ±½Óת»»Ëü£¬È磺
var a = +' Infinity ';
alert(typeof a) //number
//Èç¹û²»ÄÜת»»Ôò·µ»ØNaN
var add = function(el){
alert(el === el+1)
}
//ÇóelµÄÖµ£¬ÈÃel === el+1³ÉÁ¢£¡
//¿¼²ìjavascriptµÄÊýÖµ·¶Î§
add(Infinity)
add(Number.MAX_VALUE)
add(Number.POSITIVE_INFINITY)
add(Number.NEGATIVE_INFINITY)
alert([1,2,3,4,5][0..toString.length])
//0..Ï൱ÓÚ0.0.,ÕâÀï²»ÄÜÖ±½Óд0.to
Ïà¹ØÎĵµ£º
javascriptÖÐevent.keycode
keycode 8 = BackSpace BackSpace
keycode 9 = Tab Tab
keycode 12 = Clear
keycode 13 = Enter
keycode 16 = Shift_L
keycode 17 = Control_L
keycode 18 = Alt_L
keycode 19 = Pause
keycode 20 = Caps_Lock
keycode 27 = Escape Escape
keycode 32 = space space ......
Õâ¸öËæ±ÊÆäʵÊÇΪÁ˸ÐлÇå·çЦ¸øµÄÒ»¸öÌáʾ£¬²»½ö½öÊǸæËßÎÒÔõôÅжÏÊý×飬¸üÈÃÎÒÓÐÁËÈÏÕæ¶ÁÒ»¶Á ¡¶javascriptȨÍþÖ¸ÄÏ¡·µÄÏë·¨¡£
±È½ÏºÍ¿½±´ÆäʵÊÇÒ»»ØÊ£¬´úÂëÈçÏ£º
//
//Compare object function
//
function Compare(fobj,sobj)
{
var ftype = typ ......
JavascriptÖеļ̳лúÖÆÊÇËùνµÄÔÐͶÔÏó¼Ì³Ð£¬Í¨¹ýÊôÐÔ·ÃÎÊ»úÖƵÄÌØÊâÐÔÀ´ÊµÏּ̳еġ£Ö®Ç°ÎÒÒ»Ö±ÒÔΪËùÓжÔÏóµÄÔÐͶÔÏó¾ÍÊÇprototypeËùÖ¸µÄÄǸö¶ÔÏ󡣺óÀ´ÔÚ¿´javascriptÉè¼ÆģʽµÄʱºò·¢ÏÖ×÷Õß×¢ÖÐÓÐÒ»¾ä»°ÓëÎÒ֮ǰµÄÀí½â²»Í¬£¬Ëû˵“ÿ¸ö¶ÔÏó¶¼ÓÐÒ»¸öÔÐͶÔÏ󣬵«Õâ²¢²»Òâζ×Åÿ¸ö¶ÔÏó¶ ......
<html>
<body>
<script type="text/javascript">
//·½·¨Ò»
var num_arr= [];
for (var i = 0 ; i < 10 ; i ++)
{
num_arr[i] = i;
}
document.write(num_arr+'</br>');
//·½·¨¶þ
var obj_arr=new Array();
obj_arr[6]='ss';
document.write(obj_arr.len ......
SCRIPT 񈬀
ÓÃÓÚ°üº¬JavaScript´úÂë.
ÊôÐÔ
LANGUAGE ¶¨Òå½Å±¾ÓïÑÔ
SRC ¶¨ÒåÒ»¸öURLÓÃÒÔÖ¸¶¨ÒÔ.JS½áβµÄÎļþ
window¶ÔÏó
ÿ¸öHTMLÎĵµµÄ¶¥²ã¶ÔÏó.
ÊôÐÔ
frames[] ×ÓèåÊý×é.ÿ¸ö×ÓèåÊý×é°´Ô´ÎĵµÖж¨ÒåµÄ ......