Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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ÕÚÕÖ²ã(ת×Ôwww.cnblogs.com/wjfluisfigo)

//»ñÈ¡ä¯ÀÀÆ÷µÄ¿íºÍ¸ß£¨¶àÖÖä¯ÀÀÆ÷£©
function getNavWidthandHeightInfo()
{
    var s = "";
    s += " ÍøÒ³¿É¼ûÇøÓò¿í£º"+ document.body.clientWidth;
    s += " ÍøÒ³¿É¼ûÇøÓò¸ß£º"+  ......

Javascript ¼¼Çɼ¯ºÏ(ºÜºÃ)

   
ʼþÔ´¶ÔÏó
event.srcElement.tagName
event.srcElement.type
²¶»ñÊÍ·Å
event.srcElement.setCapture(); 
event.srcElement.releaseCapture(); 
ʼþ°´¼ü
event.keyCode
event.shiftKey
event.altKey
event.ctrlKey
ʼþ·µ»ØÖµ
event.returnValue
Êó±êλÖÃ
eve ......

JavaScript ²Ù×÷ select

Ò»¡¢ÐÂÔöÒ»¸öoption
var sel=document.getElementById("selectµÄid");
var op=document.createElement("option");
op.value=Öµ;
op.text=ÏÔʾÎı¾;
sel.add(op);
¶þ¡¢É¾³ýÒ»¸öoption
var sel=document.getElementById("typelist");
if(sel.selectedIndex==-1)
alert("ÇëÑ¡ ......

JavascriptÔÚIEºÍFireFoxÖеIJ»Í¬±íÏÖ

1.document.formName.item("itemName") ÎÊÌâ
˵Ã÷:IEÏÂ,¿ÉÒÔʹÓÃdocument.formName.item("itemName")»ò
document.formName.elements["elementName"];FirefoxÏÂ,Ö»ÄÜʹÓÃ
document.formName.elements["elementName"].
½â¾ö·½·¨:ͳһʹÓÃdocument.formName.elements["elem ......

תÔØ JavaScript»ñÈ¡Ò³Ãæ¿í¶È¸ß¶È´óÈ«

תÔØ:JavaScript»ñÈ¡Ò³Ãæ¿í¶È¸ß¶È´óÈ«
µØÖ·:http://www.cnblogs.com/wcg249165510/archive/2009/02/20/1394749.html
ÍøÒ³¿É¼ûÇøÓò¿í£ºdocument.body.clientWidth
ÍøÒ³¿É¼ûÇøÓò¸ß£ºdocument.body.clientHeight
ÍøÒ³¿É¼ûÇøÓò¿í£ºdocument.body.offsetWidth(°üÀ¨±ßÏߵĿí)
ÍøÒ³¿É¼ûÇøÓò¸ß£ºdocument.body.offsetHeight(° ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ