Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

¾«Í¨JavaScript —— º¯ÊýÖØÔغÍÀàÐͼì²é


ÆäËüÃæÏò¶ÔÏóµÄÓïÑÔÈçJAVAµÄÒ»¸ö³£¼ûÌØÐÔÊÇ£¬¸ù¾Ý´«ÈëµÄ²»Í¬ÊýÁ¿»òÀàÐ͵ģ¬Í¨¹ýÖØÔØ(overload) À´·¢»Ó²»Í¬µÄ¹¦Ó᣾¡¹ÜÕâ¸öÌØÐÔÔÚJavaScriptÖв¢Ã»ÓÐÖ±½ÓÖ§³Ö£¬Ò²Óкܶà°ì·¨Äܹ»ÊµÏÖ¡£
º¯ÊýÖØÔØ£¨function overloading£©±ØÐëÒÀÀµÁ½¼þÊÂÇ飺Åжϴ«Èë²ÎÊýµÄÊýÁ¿µÄÄÜÁ¦ºÍÅжϴ«Èë²ÎÊýÀàÐ͵ÄÄÜÁ¦¡£
JavaScriptµÄÿ¸öº¯Êý¶¼´øÓÐÒ»¸ö½öÔÚÕâ¸öº¯Êý·¶Î§ÄÚ×÷ÓõıäÁ¿£¨contextual variable£©
³ÆΪ²ÎÊý£¨argument£©,ËüÊÇÒ»¸ö°üº¬ËùÓд«¸ø²ÎÊýµÄαÊý×飨pesudo-array£©£¬ËùÒÔËü²¢·ÇÕæÕýÒâÒåÉϵÄÊý×飨Ҳ¾ÍÊÇ˵Äã²»ÄÜÐÞ¸ÄËü£¬Ò²²»ÄÜÓÃpushÀ´Ë¢ÐÂËü£©£¬µ«ÊÇ¿ÉÒÔ·ÃÎÊÆäÖеÄÔªËØ£¬ËüÒ²¾ßÓÐlengthÊôÐÔ¡£
Àý×Ó£ºJavaScriptÖк¯ÊýÖØÔصÄÁ½¸öÀý×Ó
  <script>
function sendMessage(msg,obj){
// Èç¹ûÏûÏ¢ºÍ¶ÔÏóµÄ²ÎÊý¶¼±»Ìṩ
if(arguments.length == 2){
// ¸ø¶ÔÏó·¢ËÍÏûÏ¢
obj.handleMsg(msg);
}else
alert(msg); // ·ñÔò½öÏÔʾĬÈϵĴíÎóÐÅÏ¢
}
sendMessage("hello world!"); // ½ö´«µÝÒ»¸ö²ÎÊý£¬ÏÔʾ´íÎóµÄÌáʾÐÅÏ¢
// Êä³ö½á¹ûΪ£º¾¯Ê¾¿ò hello world
/*ÓÖ»òÕßÎÒÃÇ¿ÉÒÔ½«Ò»¸öÎÒÃÇ×Ô¼ºÐ´ºÃµÄ¶ÔÏó´«È룬¸ºÔðÓÃÁíÒ»Ì×°ì·¨ÏÔʾÐÅÏ¢*/
sendMessage("how are you?" , {
handleMsg: function(msg) {
alert("This is a custom message:" + msg);
}
});
// Êä³ö½á¹ûΪ£º¾¯Ê¾¿ò This is a custom message how are you?
/*
var obj = new Object();//´´½¨Ò»¸öжÔÏó²¢½«Æä´æ·ÅÔÚobjÀï 
obj.val = 5;           //½«¸Ã¶ÔÏóµÄһЩÊôÐÔÉèÖóɲ»Í¬µÄÖµ 
obj.click = function(){ 
alert( "hello" ); 
}; 
//ÏÂÃæÊǵÈЧµÄ´úÂ룬ʹÓÃÁË{...}ʽËõд£¬ 
//ºÍ¶¨Òå¶ÔÏóÊôÐÔµÄ"Ãû³Æ-Öµ"¶Ô 
var obj = { 
//ÓÃÃû³Æ-Öµ¶ÔÉèÖöÔÏóÊôÐÔ 
val: 5, 
click: function(){ 
alert( "hello" ); 

}; 
*/
// Ò»¸ö½ÓÊÜÈÎÒâÊýÁ¿²ÎÊý£¬²¢×ª»¯ÎªÊý×éµÄº¯Êý
function makeArray() {
var arr 


Ïà¹ØÎĵµ£º

JavaScript ÍøÒ³±³¾°Í¼Æ¬Ëæ»ú»¯

 µ¥µ÷µÄÍøÕ¾Ê×Ò³±³¾°¿´¶àÁ˲»ÃâÓÐдÑá·³£¬Èç¹ûÓû§×Ô¼ºÃ¿Ë¢ÐÂÒ»´ÎÒ³Ãæ±³¾°¿ÉÒÔ¸ü»»Ò²ÐíÄÜΪÕâÖÖµ¥µ÷Ìíһ˿µÄÐÂÆæ¡£ÕâÖ»ÐèÓÃÒ»¸öJavaScript·½·¨¾Í¿ÉÒԸ㶨£¬Í¨¹ýËæ»úº¯ÊýÔÚÎÒÃǵÄÒ»×éͼƬÖÐËæ»úµÄÑ¡Ò»ÕÅ×÷Ϊ±³¾°¡£
ÏÂÃæÊÇJavaScript´úÂ룺
view plaincopy to clipboardprint?
<mce:script type="text/javascript" ......

javaScript document¶ÔÏóÏê½â

 Document¶ÔÏóÄÚÈݼ¯ºÏ
document Îĵ²¶ÔÏó - JavaScript½Å±¾ÓïÑÔÃèÊö
———————————————————————
×¢:Ò³ÃæÉÏÔªËØnameÊôÐÔºÍJavaScriptÒýÓõÄÃû³Æ±ØÐëÒ»Ö°üÀ¨´óСд
·ñ ......

firefoxÓëIE¼æÈÝjavascriptºÍCSS


css:
1.   
ul±êÇ©ÖÐFFÖÐÓиöpaddingÖµ£¬È´Ã»ÓÐmarginÖµ£¬¶øÔÚIEÖÐÕýºÃÏà·´   
½â¾ö°ì·¨:½«ulµÄpaddingºÍmargin¶¼ÉèΪ0(Ò²¿ÉÒÔ²»ÊÇ0)È磺padding:0;margin:0;list-style:none;   
ÁíÍâformĬÈÏÔÚIEÖÐÒ²»áÓÐmarginÖµ£¬ËùÒÔ×îºÃÒ²½«ÆämarginºÍpaddingÉèΪ0   
2.    ......

ÈÃeval()È«¾Ö×÷ÓÃÓòÖ´Ðеķ½·¨ÉîÈëÑо¿(javascript)

 
eval(str)
ÓÃÀ´´«ÈëÒ»¸ö×Ö·û´®¶¯Ì¬Ö´ÐÐÒ»¶Î½Å±¾£¬Õâ¸ö·½·¨·Ç³£ÓÐÓᣵ±Ö±½ÓÓÃeval()ʱ£¬×÷ÓÃÓòΪµ±Ç°×÷ÓÃÓò£¬ÓÐʱºòÎÒÃÇÐèÒªÈÃËüÔÚÈ«¾Ö×÷ÓÃÓò·¶Î§ÄÚÖ´ÐУ¬±ÈÈç
ajax·µ»ØµÄ½Å±¾×Ö·û´®£¬È»¶øä¯ÀÀÆ÷¶ÔevalµÄ²îÒì¿ÉÄÜʹÊÂÇé¸Õ¿ªÊ¼²¢²»ÊÇÄÇô˳Àû£¬±¾ÎÄͨ¹ýÔÚ7ÖÖä¯ÀÀÆ÷(IE, Firefox,
Chrome, Safari, Opera£©»·¾³Öвâ ......

javascript ʼþÁбí½â˵

 



javascript
ʼþÁбí½â˵
ʼþ
ä¯ÀÀÆ÷Ö§³Ö
½â˵
Ò»°ãʼþ
onclick
IE3¡¢N2
Êó±êµã»÷ʱ´¥·¢´Ëʼþ
ondblclick
IE4¡¢N4
Êó±êË«»÷ʱ´¥·¢´Ëʼþ
onmousedown
IE4¡¢N4
°´ÏÂÊó±êʱ´¥·¢´Ëʼþ
onmouseup
IE4¡¢N4
Êó±ê°´ÏºóËÉ¿ªÊó±êʱ´¥·¢´Ëʼþ
onmouseover
IE3¡¢N2
µ±Êó±êÒƶ¯µ½Ä³¶ÔÏ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ