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

ÐÂÈËjavascriptÎÊÌâÇóÖú£¬Çë¸÷λ´ó¸ç´ó½ãÃÇÀ´°ï棡

ÕâÊÇÎÒµÄÎı¾¿ò
<input type="text" size="60" name="password_answer" id="pwdanswer" value="$!password_answer" >
Ìá½»°´Å¥
<input class="standardButton" type="submit" name="submitType" oncvalue="Ok">

ÏÖÔÚÓиöHTMLÎÊÌ⣬ ¾ÍÊǵ±ÎÒÊäÈë(&lt; &gt; &amp; etc)ÕâЩʱºò£¬Ò»Ìá½»£¬Ëü¾Í»á±ä³É < À¨ºÅ£¬½â¾ö¾ÍÊÇÓÃÕâ¸öÀ´(&amplt; &amp;gt; &amp;amp; etc)Ìæ»»£¬Æäʵ¾ÍÊÇ&amp;gt;µÈÓÚ&gt;

ÎÒÕÒµ½ÁËÒ»¸öjavascriptµÄreplace()·½·¨£¬¾ÍÊÇÏë°ÑÊäÈë&gt;Ìύʱºò£¬ÓÃ&amp;gt;Ìæ»»£¬¾ÍÕâ4¸ö¡£
µ«ÊDz»ÖªµÀÈçºÎʹÓÃjavascriptµÄreplace()·½·¨£¬Çë¸÷λ´ó¸ç»áµÄ»°½Ì½ÌСµÜ¡£¸Ðл

ÔÚsubmit°´Å¥ÉÏÉèÖÃonClick="return methon();"
JScript code:

<script>
function methon(){
var dict = {"&lt;","&gt;"};
var words = {"<",">"};
var pwdanswer = document.getElementById("pwdanswer");
var pwdstr = pwdanswer.value;
for(var i = 0; i < dict.length; i++){
pwdstr = pwdstr.replaceAll(dict[i],words[i]);
}
pwdanswer.value=pwdstr;
return true;
}
<script>




Ïà¹ØÎÊ´ð£º

¼±ÇóÒ»¸öÔÚÍøÒ³ÖÐÑéÖ¤Óû§ÊäÈëµÄJavaScript´úÂë

±ÈÈçÓÐÒ»¸ötextbox£¬Óû§ÊäÈëºóµãbutton°´Å¥Ê±£¬ÊµÏÖÓÃJavaScript¶ÔtextboxÊäÈëÐÅÏ¢µÄÑéÖ¤£¬±ÈÈçÑéÖ¤Óû§ÊäÈëµÄÊÇ·ñÊÇÊý×Ö¡£
Ï£Íû½«HTML´úÂëÒ»²¢Ð´³öÀ´¹þ£¬Ð»Ð»¡£
HTML code:

<!DOCTYPE html PUBLIC &quo ......

ÇóÒ»¸öÓÃÕýÔò±í´ïʽʵÏÖ¼òµ¥ÑéÖ¤µÄJavaScript´úÂë

ÈçÓÐÒ»¸ötextbox£¬Óû§ÊäÈëºóµãbutton°´Å¥Ê±£¬ÊµÏÖÓÃJavaScript¶ÔtextboxÊäÈëÐÅÏ¢µÄÑéÖ¤£¬ÒªÇóÓÃJavaScriptÀ´ÊµÏÖ£¬±ÈÈçÑéÖ¤Óû§ÊäÈëµÄÊÇ·ñÊÇÊý×Ö¡£
Ï£Íû½«HTML´úÂëÒ»²¢Ð´³öÀ´¹þ£¬Ð»Ð»
HTML code:

<!DOC ......

ActiveXºÍJavaScriptµÄ½»»¥ÎÊÌâ

    ÎÊÌâÃèÊöÈçÏ£º
    ÓÃC#¿ª·¢µÄActiveXǶÈëÍøÒ³ÖУ¬¸ÃActiveXÖÐÓÐÒ»¸ö°´Å¥button1.ÏÖÔÚҪʹµÃÓû§µ¥»÷ÁËbutton1ºóʵÏÖÒ³ÃæÌøתµÄ¹¦ÄÜ£¬¼´Óɵ±Ç°µÄ1.htmÌøתµ½2.htm¡£
    Î ......

javascript¸ßÊÖÇë½ø

javascriptÖÐ2¼¶Ê¼þÖÐDOM°ÑËü·ÖÎļþÊ÷£¬ÄǸöÎļþÊ÷µÄ½á¹¹ÊÇÔõôÑùµÄ£¿2¼¶´«²¥Öи¸½ÚµãºÍ×Ó½ÚµãµÄ¹Øϵ£¬ÄܾٸöÀý×Ó˵Ã÷Ò»ÏÂÂð£¿ÊéÉÏдµÃºÜÂÒ£¬Àý×ÓҲû¾Ù¡£Ð»Ð»ÁË£¡





µÍÊÖÆ®¹ý¡£

˵ÆðÀ´ÊÇͦ¸´Ôӵģ¬² ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ