javascript ÌØÕ÷Õì²â¼¼Êõ
ÕâÖÖÐÂʽµÄ¼¼Êõ×îÏÈÓÉjQuery¸ã³öÀ´µÄ£¬½Ó×ÅPrototypeÓëmootools¶¼Ö§³ÖÁË¡£Õâ¼¼ÊõÐËÆðµÄÔÒòÊÇä¯ÀÀÆ÷Ðá̽¼¼ÊõÊDz»Ì«¿É¿¿£¬ÈçUserAgentºÜÈÝÒ×±»Î±Ô죬ÈçIE8µÄUserAgent¾Í°ÑÐí¶àä¯ÀÀÆ÷µÄ¹Ø¼ü×Ö°üº¬½øÈ¥£¬Ôì³É±çʶÀ§ÄÑ¡£ÆäËûһЩÖØÒª±çʶÊֶΣ¬ÓÉÓÚä¯ÀÀÆ÷³§É̶Ծɰ汾µÄÉý¼¶Óë²»¶ÏÍƽøа汾£¬Ðí¶à¶¼ÎÞЧÁË¡£ÓÉÓÚä¯ÀÀÆ÷ÖÖÀàÔ½À´Ô½¶à£¬°æ±¾Ò²Ô½À´Ô½¶à£¬¿´¿´ExtµÄºËÐÄÎļþ°É£¬ÕæÊÇÓÐÄÍÐÔ£¬Á¬»ðºüÓëÆ»¹ûµÄ¸÷¸ö°æ±¾¶¼ÁгöÀ´£¬ÕⶫÎ÷»áûÓÐÖ¹¾³µØÅòÕÍ£¬Îª´ËÌØÕ÷Õì²â¼¼ÊõÓ¦Ô˶øÉú¡£ÕⶫÎ÷Ö»ÒªÊÇÓÃÀ´Õì²âä¯ÀÀÆ÷¹¤³§×Ô×÷´ÏÃ÷Ìí¼ÓµÄһЩÌØÕ÷£¬²»ÓÃ˵£¬Ê×µ±Æä³åÊÇIE£¬Èç×Ô¶¯ÎªtableÌí¼Ótbody£¬×Ô¶¯ÎªinnerHTMLÈ¥³ý¿Õ°×£¬×Ô¶¯ÎªhrefÊôÐÔ²¹È«Â·¾¶¡¡ËäÈ»ÓеĵÄÈ·ºÜÓÐÓã¬ÈçΪtableÌí¼ÓtbodyÄܼӿì¶ÁдËٶȣ¬µ«±ê×¼ä¯ÀÀÆ÷²»ÕâÑù×ö£¬ÓÚÊÇÂé·³ÓÖÀ´ÁË¡¡
innerHTMLÈ¥³ý¿Õ°×ÌØÐÔ¡£°´Àí½²£¬innerHTMLÊÇIE¸ã³öÀ´µÄ£¬ÆäËûä¯ÀÀÆ÷Ó¦¸ÃÍêÈ«°´ÕÕIEµÄģʽäÖȾ²Å¶Ô²»Æ𣬵«ËüÃÇ×ÜÒª¸ã³öÒ»µãÌØÊâÀ´¡£²»¹ý£¬IEµÄinnerHTMLµÄÈ·Óв»Í׵ĵط½¡£°´Î¢ÈíµÄ˼·£¬innerHTMLÊÇÓÃÀ´´ó¹æÄ£Éú³ÉDOMÔªËØ£¬Èç¹ûÓÐһЩ¿Õ°×²»ÊÇ°üΧÔÚ±êÇ©Ö®ÄÚ£¬½«»á±»ºöÂÔµô¡£ÕâÊǺÜϸÐĵĴ¦Àí¡£µ«±ê×¼ä¯ÀÀÆ÷ÔòÈÏΪinnerHTMLÉú³ÉµÄÊÇÒ³ÃæµÄÒ»²¿·Ö£¬¿Õ°×Ò²ÊÇ£¬Òò´Ë¿Õ°×²»»á±»ºöÂԵġ£×¢ÒâÔËÐпòµÄ½á¹û£¬1´ú±íÔªËؽڵ㣬3ÊÇÎı¾½Úµã£¬¿Õ°×Ò²ÊÇÎı¾½ÚµãµÄÒ»ÖÖ¡£ÕâÖÖÌØÕ÷£¬jQuery³Æ֮ΪleadingWhitespace¡£
<!doctype html>
<html dir="ltr" lang="zh-CN">
<head>
<meta charset="utf-8"/>
<title>ÌØÕ÷Õì²â¼¼Êõ By ˾ͽÕýÃÀ</title>
<script type="text/javascript">
window.onload = function(){
var p = document.getElementById("p");
p.innerHTML = " <span>ÄãºÃ£¡</span>"
alert(p.firstChild.nodeType);
}
</script>
</head>
<body>
<p id="p"></p>
</body>
</html>
ÔËÐдúÂë
table×Ô¶¯²åÈëtbody¡£ÔÚ±í¸ñ²¼¾ÖµÄÄê´ú£¬ÕâÌØÕ÷·Ç³£ÊÜÓõġ£ÒòΪÈç¹ûûÓÐtbody£¬table»áÔÚä¯ÀÀÆ÷½âÎöµ½±ÕºÏ±êǩʱ²ÅÏÔʾ³öÀ´£¬Èç¹ûÆðʼ±êÇ©Óë±ÕºÏ±êÇ©Ïà¸ôºÜÍ꣬»»ÑÔÖ®£¬Õâ±í¸ñºÜ´óºÜ³¤£¬Óû§»á¿´Ê²Ã´Ò²¿´²»µ½¡£µ«ÓÐÁËtbody·Ö¶Îʶ±ðºÍÏÔʾ£¬±ÜÃâÁËÒ³Ã泤ʱ¼äһƬ¿Õ°×È»ºóͻȻһÏÂ×ÓÄÚÈÝÈ«²¿³öÀ´µÄ¾ÖÃæ¡£²»¹ý£¬ÕâÖ»ÒòΪIEäÖȾËÙ¶ÈÌ«ÂýµÄÔµ¹Ê£¬
Ïà¹ØÎĵµ£º
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="re ......
<script type="text/javascript">
<!--
function myCheck() {
var str = "";
for(var i=0; i<document.forms[0].chk_type.length; i++) {
......
JavaScriptÔÊÐí´´½¨ºÍ´ò¿ª´ú±íHTMLÎı¾, form¶ÔÏóºÍframeµÄ´°¿Ú. window¶ÔÏóÊÇJavaScript¿Í»§²ã´Î½á¹¹µÄ×²ã¶ÔÏó, formÔªËغÍÈ«²¿JavaScript´úÂ붼ÊÇ´æÔÚÓÚÎĵµÖÐ,¶øÎĵµ±»×°Ôؽø´°¿Ú. ΪÁËÀí½â´°¿ÚÔõÑù¹¤×÷,Äã¿ÉÒÔ¿ØÖƲÙ×÷ÕâЩ´°¿Ú.
´ò¿ªºÍ¹Ø±Õ´°¿Ú
µ±Óû§Æô¶¯(launch)Navigatorʱ,½«×Ô¶¯´´½¨Ò»¸ö´°¿Ú.Óû§»¹¿ÉÒÔÊ¹Ó ......
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="re ......
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="re ......