JavaScript»ñÈ¡µ±Ç°Îļþȫ·¾¶¡¢µ±Ç°Ä¿Â¼¡¢µ±Ç°ÎļþÃû
//»ñÈ¡µ±Ç°Îļþȫ·¾¶
<script language="javascript">
alert(window.location.href);
alert(window.location);
alert(location.href);
alert(parent.location.href);
alert(top.location.href);
alert(document.location.href);
alert(document.URL);
</script>
//»ñÈ¡µ±Ç°Ä¿Â¼·½·¨
<script type="text/javascript">
//·½·¨Ò»
var str = location.href;
var arr = str.split("/");
delete arr[arr.length-1];
var dir = arr.join("/");
alert(dir);
//·½·¨¶þ
alert(location.href.substring(0,location.href.lastIndexOf('/')));
</script>
//»ñÈ¡µ±Ç°ÎļþÃû
<script language=javascript>
var filename=location.href;
filename=filename.substr(filename.lastIndexOf('/')+1);
alert(filename);
</script>
Ïà¹ØÎĵµ£º
a href="javascript:if(confirm(
ÐüÉÍ·Ö£º0 - ½â¾öʱ¼ä£º2008-9-25 13:58
a href="javascript:if(confirm('http://hunter.51rc.com/ \n\nÎļþ²¢Î´ÒÀ Teleport Pro È¡»Ø£¬ÒòΪ ËüµÄÓò»ò·¾¶³¬¹ý¿ªÊ¼ÍøÖ·ÖÐÉèÖõķ¶Î§¡£ \n\nÄãÒª´Ó·þÎñÆ÷ÉÏ´ò¿ªËüÂð£¿'))window.location='http://hunter.51rc.com/'" tppabs="http://h ......
¼òµ¥µÄÀý×Ó£¬×Ô¼º¿´¿´£¬Ê¡µÃÒÔºóÀÏÊÇÈ¥ÕÒÁË¡£
<script language="javascript">
//ÓÃÕýÔòÌæ»»½«XÌæ»»³Éy
var s="daxdasx";//Ô×Ö·û´®
var k="x";//±»Ìæ»»µÄ×Ö¶Î
var re = new RegExp(k,"g");
alert("Ì滻ǰ×Ö·û´®Îª£º"+s);
s = s.replace(re,"y");
alert("Ìæ»»ºó×Ö·û´®Îª£º"+s);
</script> ......
JavaScript½øÐÐGETºÍPOSTÇëÇó
WebÉÏ×î³£¼ûµÄÇëÇó¾ÍÊÇGETÇëÇó.ÿ´ÎÔÚä¯ÀÀÆ÷ÖÐÊäÈëURL²¢´ò¿ªÒ²Ã×ÄÉÊÐ,¾ÍÊÇÔÚÏò·þÎñÆ÷·¢ËÍÒ»¸öGETÇëÇó.
GETÇëÇó£º
GETÇëÇóµÄ²ÎÊýʹÓÃÎʺÅ×·¼Óµ½URLµÄ½áβ,ºóÃ×ÄɸøÕâÓÃ&ºÃÁ¬½ÓÆðÀ´µÄÃû³Æ/Öµ.ÀýÈç:
http://www.somewhere.com/page.php?name1=value1&name2=value2&name3=value3
......
ÔÚÊý°ÙÍòÕÅÒ³ÃæÖУ¬JavaScript ±»ÓÃÀ´¸Ä½øÉè¼Æ¡¢ÑéÖ¤±íµ¥¡¢¼ì²âä¯ÀÀÆ÷¡¢´´½¨cookies£¬µÈµÈµÈµÈ¡£
JavaScript ÊÇÒòÌØÍøÉÏ×îÁ÷ÐеĽű¾ÓïÑÔ£¬²¢ÇÒ¿ÉÔÚËùÓÐÖ÷ÒªµÄä¯ÀÀÆ÷ÖÐÔËÐУ¬±È·½Ëµ Internet
Explorer¡¢ Mozilla¡¢Firefox¡¢Netscape¡¢ºÍ Opera¡£
......
ClosureÖÐÎÄ·ÒëΪ±Õ°ü.×ÖÃæÉÏÀ´Àí½â¾ÍÊÇ"·â±ÕµÄ°ü".(ÕâÊÇÒ»¾ä·Ï»°)
±Õ°üÊÇʲô?
ÊéÃæ½âÊÍΪ: Ëùν“±Õ°ü”£¬Ö¸µÄÊÇÒ»¸öÓµÓÐÐí¶à±äÁ¿ºÍ°ó¶¨ÁËÕâЩ±äÁ¿µÄ»·¾³µÄ±í´ïʽ£¨Í¨³£ÊÇÒ»¸öº¯Êý£©£¬Òò¶øÕâЩ±äÁ¿Ò²ÊǸñí´ïʽµÄÒ»²¿·Ö¡£
ÎÒÈÏΪ±Õ°ü¾ÍÊÇÄܹ»¶Á/дº¯ÊýÄÚ²¿µÄijЩ±äÁ¿µÄ×Óº¯Êý,²¢½«ÕâЩ±äÁ¿±£´æÔÚÄÚ´æÖÐ.
± ......