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

JavaScriptµÄ Cross Site ½Å±¾×¢Èë·çÏÕ

    ½ñÌìÓÐÈËÀ´¹«Ë¾ÍÆÏúÍøÕ¾°²È«É¨ÃèÈí¼þ£¬ÑÝʾÁ˶ÔJSµÄ¿çÓò½Å±¾×¢Èë·çÏÕµÄɨÃ裬ÒÔǰûÒâʶµ½£¬½ñÌìÓÐËùÁ˽⡣Èç¹ûÄúµÄ³ÌÐòÒ³ÃæÓÐÒÔÏÂÇé¿ö£¬ÄÇôJS½Å±¾×¢ÈëµÄ·çÏվͺܴó£º
1£©Ò³Ãæ´ò¿ªÊ±£¬URL ÓÐij¸ö²ÎÊý£¬ÀýÈç XXPage.aspx?XXParam=XXValue
2£©aspxÒ³ÃæÀïÓÐÈçÏ´úÂ룺
<script>
    var p = "<%=Request["XXParam"];%>";
</script>
×¢Èë·çÏÕÈçÏ£º
1£©ºÚ¿Í¼ÙÃ°ÍøÕ¾Éí·Ý·¢ËÍÓʼþ¸øÓû§£¬Óû§´ò¿ªÍøÒ³Á´½Ó£¬Á´½ÓËäÈ»ÊÇÖ¸Ïò XXPage.aspx£¬µ« XXParam È´±»×öÁ˸ÄÔ죬ÀýÈ磺XXParam ±»ÉèÖÃΪ "; document.location.href = 'http://www.xxx.com/XXFakePage.aspx';//"¡£×¢Òâ£¬Ç°ÃæµÄË«ÒýºÅÊÇÓÃÀ´ÆÁ±Î var p = " µÄ£¬ºóÃæ½ô½ÓמÍÊÇÒ»¸öJSÒ³ÃæÌø×ªÓï¾ä£»×îºóÃæµÄ //" ÊÇÓÃÀ´ÆÁ±Î JS ½Å±¾ÖеĺóÒýºÅµÄ¡£
Äã²Â½á¹û»áÔõôÑù£¿Ò³ÃæÖ±½Ó±»Ìø×ªµ½ http://www.xxx.com/XXFakePage.aspx£¬Èç¹ûÕâ¸öÒ³ÃæÊǼÙÃ°Ò³Ãæ£¬²¢ÇÒÕâ¸öÒ³ÃæÊÇǶÈëÔÚ Frameset ÀïµÄ£¬ÄÇÓû§»áÔÚºÁÎÞ¾õ²ìµÄÇé¿öÏ£¬°Ñ×¢ÈëÓû§Ãû¡¢ÃÜÂë¡¢ÒøÐп¨Õ˺ÅÃÜÂëÌá½»µ½¼ÙÃ°Ò³ÃæÉÏ£¡£¡
¶Ô²ß£º
·½·¨Ò»£º²»ÒªÓà <%=Request["XXParam"];%> À´½âÎö²ÎÊýÖµ£¬¶øÖ±½ÓÓà JS ½Å±¾´ÓURL»ñÈ¡²ÎÊýÖµ
·½·¨¶þ£º°Ñ²ÎÊýÖµÏÈ·ÅÔÚ HIDDEN ¿Ø¼þÀÀýÈç: <input type=hidden id=xxhid value="<%=Server.HtmlEncode(Request["XXParam"]);%>"> ÀȻºóÔÚ JS Àï¸ÄΪ var p = document.all.xxhid.value;
Ó¦¸Ã»¹ÓÐÆäËû·½·¨£¬ÒÔÉÏ·½·¨Ö»ÊÇʾÒ⣬ûÓÐÈ¥±àÒ룬½ö¹©²Î¿¼¡£


Ïà¹ØÎĵµ£º

JavaScriptÄÚ´æÐ¹Â©

1¡¢Ê²Ã´ÊDZհü¡¢ÒÔ¼°±Õ°üËùÉæ¼°µÄ×÷ÓÃÓòÁ´ÕâÀï¾Í²»ËµÁË¡£
2¡¢JavaScriptÀ¬»ø»ØÊÕ»úÖÆ 
     JavaScript²»ÐèÒªÊÖ¶¯µØÊÍ·ÅÄڴ棬ËüʹÓÃÒ»ÖÖ×Ô¶¯À¬»ø»ØÊÕ»úÖÆ£¨garbage collection£©¡£µ±Ò»¸ö¶ÔÏóÎÞÓõÄʱºò£¬¼´³ÌÐòÖÐÎÞ±äÁ¿ÒýÓÃÕâ¸ö¶ÔÏóʱ£¬¾Í»á´ÓÄÚ´æÖÐÊͷŵôÕâ¸ö±äÁ¿¡£
 
Code
 &nb ......

ÉîÈëÀí½âJavascript±Õ°ü

 ×î½üÔÚÍøÉϲéÔÄÁ˲»ÉÙJavascript±Õ°ü(closure)Ïà¹ØµÄ×ÊÁÏ£¬Ð´µÄ´ó¶àÊǷdz£µÄѧÊõºÍרҵ¡£¶ÔÓÚ³õѧÕßÀ´Ëµ±ð˵Àí½â±Õ°üÁË£¬¾ÍÁ¬ÎÄ×ÖÐðÊö¶¼ºÜÄÑ¿´¶®¡£×«Ð´´ËÎĵÄÄ¿µÄ¾ÍÊÇÓÃ×îͨË×µÄÎÄ×Ö½Ò¿ªJavascript±Õ°üµÄÕæÊµÃæÄ¿¡£
¡¡¡¡Ò»¡¢Ê²Ã´ÊDZհü£¿
¡¡¡¡“¹Ù·½”µÄ½âÊÍÊÇ£ºËùν“±Õ°ü”£¬Ö¸µÄÊÇÒ»¸öÓµÓÐÐ ......

javascript Ö® Closure

http://javascript.crockford.com/private.html
function a() {
var i = 0;
function b() {
alert(++i);
}
return b;
}
var c = a();
c();
 
µ±ÔÚº¯ÊýbÖзÃÎÊÒ»¸ö±äÁ¿µÄʱºò£¬ËÑË÷˳ÐòÊÇ£º
ÏÈËÑË÷×ÔÉíµÄ»î¶¯¶ÔÏó£¬Èç¹û´æÔÚÔò·µ»Ø£¬Èç¹û²»´æÔÚ½«¼ÌÐøËÑË÷º¯ÊýaµÄ»î¶¯¶ÔÏó£¬ÒÀ ......

JavascriptÖÐ×î³£ÓõÄ61¸ö¾­µä¼¼ÇÉ

 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 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ