javascriptÉè¼Æģʽ֮¹¤³§Ä£Ê½
¹¤³§Ä£Ê½·ÖΪ¼òµ¥¹¤³§Ä£Ê½ºÍ¸´ÔÓ¹¤³§Ä£Ê½£¬Ç°ÕßÊÇʹÓÃÒ»¸öÀàÀ´Éú³ÉʵÀý£¬Í¨³£ÊÇÒ»¸öµ¥Ì壬ºóÕßÊÇʹÓÃ×ÓÀàÀ´¾ö¶¨Ò»¸ö³ÉÔ±±äÁ¿ÊÇÄĸöÀàµÄ¾ßÌåʵÀý£¬Ò²¾ÍÊǼòµ¥¹¤³§°üº¬ÔÚ¸´ÔÓ¹¤³§Ö®ÖС£
ÏÂÃæͨ¹ýÒ»¸ö¾ßÌåµÄʵÀýÀ´¾ßÌåµÄ˵˵Õ⹤³§µÄÒ»¶þ°É¡£
ÓÃAjax¼¼Êõ·¢ÆðÒì²½ÇëÇóÊÇÏÖÔÚweb¿ª·¢ÖеÄÒ»¸ö³£¼ûÈÎÎñ¡£
1 //implements AjaxHandler£¬´´½¨Ò»¸ö¸´ÔӵŤ³§À´Ö´ÐÐAjaxµÄһϵÁÐÁ÷³Ì£¬ÀïÃæ°üº¬ÁËÁ½¸ö¼òµ¥¹¤³§
2 var SimpleHandler = function(){};
3
4 SimpleHandler.prototype = {
5 //µÚÒ»¸ö¼òµ¥¹¤³§Ö´ÐÐAjaxµÄ´´½¨£¬ÇëÇ󣬷¢ËÍ¡£¡£¡£µÈ
6 request:function(method,url,callback,postVars){
7 var xhr = this.createXhrObject();
8 xhr.onreadystatechange = function(){
9 if(xhr.readyState != 4) return;
10 (xhr.status == 200) ?
11 //¶¨ÒåÁËÒ»¸öÈ«¾Ö¶ÔÏócallbackÀ´Ö´ÐжԷµ»Ø²ÎÊýµÄÓ¦ÓÃ
12 callback.success(xhr.responseText,xhr.responseXML):
13 callback.failure(xhr.status);
14 };
15 xhr.open(method,url,true);
16 if(method != "POST") postVars = null;
17 xhr.send(postVars);
18 },
19 //µÚ¶þ¸ö¼òµ¥¹¤³§ÊǸù¾Ý²»Í¬µÄÇé´´½¨XHR¶ÔÏ󣬲»ÂÛʲôÇé¿öËû¶¼ÄÜ·µ»ØÒ»¸öÕýÈ·µÄXHR¶ÔÏó
20
Ïà¹ØÎĵµ£º
½ñÌìżȻ¿´µ½ÁËconstructorÕâ¸ö¶«¶«£¬²»Ã÷°×ÓÃ;¡£Õҵ㶫Î÷±¸Íü
typeofº¯ÊýµÄÓ÷¨¿ÉÄܲ»ÓÃÎÒ¶à˵£¬´ó¼Ò¶¼ÖªµÀÔõôÓ᣶øconstructorÊôÐÔ´ó¼Ò¿ÉÄܾÍÄ°Éúµã¡£ÔÚ¡¶¾«Í¨JavaScript¡·Õâ±¾ÊéÖÐÓÐÌáµ½constructµÄÓ÷¨£¬µ«ÎÒÓÃ×Ô¼ºµÄ¼¸¸öä¯ÀÀÆ÷£¨IE7.0 / Firefox1.9 / Opera9.50£©²âÊԵĽá¹ûÈ´ºÍÊéÉÏ˵µÄ²»Ò»Ñù¡£µ«ÊÇÈÔÈ»ÊÇÓÐ°ì·¨Í ......
¡¾Ç°ÑÔ¡¿ºÃÎÄÕ£¬¾ÍÊÇÒªÂýÂýÑо¿£¬ËùÒÔÏÈת¹ýÀ´´æ×Å~
1. oncontextmenu="window.event.returnValue=false" ½«³¹µ×ÆÁ±ÎÊó±êÓÒ¼ü
<table border oncontextmenu=return(false)><td>no</table> ¿ÉÓÃÓÚTable
2. <body onselectstart="return false"> È¡ÏûÑ¡È¡¡¢·ÀÖ¹¸´ÖÆ
3. onpaste="return false" ......
JavaScriptºÍJavaµÄÇø±ð
¡¡¡¡ËäÈ»JavaScriptÓëJavaÓнôÃܵÄÁªÏµ£¬µ«È´ÊÇÁ½¸ö¹«Ë¾¿ª·¢µÄ²»Í¬µÄÁ½¸ö²úÆ·¡£JavaÊÇSUN¹«Ë¾ÍƳöµÄÐÂÒ»´úÃæÏò¶ÔÏóµÄ³ÌÐòÉè¼ÆÓïÑÔ£¬ÌرðÊʺÏÓÚInternetÓ¦ÓóÌÐò¿ª·¢£»¶øJavaScriptÊÇNetscape¹«Ë¾µÄ²úÆ·£¬ÆäÄ¿µÄÊÇΪÁËÀ©Õ¹Netscape Navigator¹¦ÄÜ,¶ø¿ª·¢µÄÒ»ÖÖ¿ÉÒÔǶÈëWebÒ³ÃæÖеĻùÓÚ¶ÔÏóºÍʼþÇý¶ ......
JavaScriptÊÇ»ùÓÚ¶ÔÏóµÄÓïÑÔ¡£ÎÒÃÇÖªµÀ£¬¶ÔÏóÊÇÓÉÒ»×éÊý¾Ý(JavaScriptÖгÆ֮ΪÊôÐÔ)ºÍÊ©¼ÓÔÚÕâ×éÊý¾ÝÉϵķ½·¨×é³ÉµÄ¡£Í¬Ê±£¬JavaScriptÖл¹ÓÐһЩ²»ÊôÓÚÈκζÔÏóµÄϵͳº¯Êý¡£±¾ÎĽ«¼òµ¥½éÉÜJavaScriptÖÐһЩ³£ÓöÔÏóµÄÊôÐԺͷ½·¨£¬ÒÔ¼°¼¸¸öÓÐÓõÄϵͳº¯Êý¡£
¡¡¡¡Ò»¡¢´®·½·¨
¡¡¡¡JavaScriptÓÐÇ¿´óµÄ´®´¦Àí¹¦ÄÜ£¬ÓÐÁËÕâЩ´® ......
1. oncontextmenu="window.event.returnValue=false" ½«³¹µ×ÆÁ±ÎÊó±êÓÒ¼ü
<table border oncontextmenu=return(false)><td>no</table> ¿ÉÓÃÓÚTable
2. <body onselectstart="return false"> È¡ÏûÑ¡È¡¡¢·ÀÖ¹¸´ÖÆ
3. onpaste="return false" ²»×¼Õ³Ìù
4. oncopy="return false;" oncut="return f ......