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>
Ïà¹ØÎĵµ£º
ÔÚÊý°ÙÍòÕÅÒ³ÃæÖУ¬JavaScript ±»ÓÃÀ´¸Ä½øÉè¼Æ¡¢ÑéÖ¤±íµ¥¡¢¼ì²âä¯ÀÀÆ÷¡¢´´½¨cookies£¬µÈµÈµÈµÈ¡£
JavaScript ÊÇÒòÌØÍøÉÏ×îÁ÷ÐеĽű¾ÓïÑÔ£¬²¢ÇÒ¿ÉÔÚËùÓÐÖ÷ÒªµÄä¯ÀÀÆ÷ÖÐÔËÐУ¬±È·½Ëµ Internet
Explorer¡¢ Mozilla¡¢Firefox¡¢Netscape¡¢ºÍ Opera¡£
......
Èç¹ûÄú»¹Ã»ÓÐÔĶÁ¡¶JavaScriptµ÷ÊÔ¼¼ÇÉÖ®£º¿ìËÙ¶¨Î»¡·£¬½¨ÒéÏÈ¿´¿´ÄÇƪ¡£Ëµ²»¶¨£¬ÓÿìËÙ¶¨Î»¾ÍÄܽâ¾öÎÊÌâÁË£¬ºÇºÇ¡£Õâ´ÎÎÒ»á×ܽá¼Ç¼һ϶ϵãµ÷ÊԵıʼǣ¬Ï£ÍûÒ²¶Ô´ó¼ÒÓÐÓ㬻¶Ó²¹³ä½»Á÷£¡
Ê×ÏÈ£¬ÔÚ¸÷¸öä¯ÀÀÆ÷ÖУ¬¶Ïµãµ÷ÊÔÖ§³ÖµÄ×îºÃµÄµ±È»ÊÇFirefox£¬Firefox²»½ö¿ÉÒÔʹÓÃFirebugµ÷ÊÔÒ³Ãæjs½Å±¾£¬»¹¿ÉÒÔÓø߼¶µ÷ÊÔ¹¤¾ßÀ ......
ÔÎijö´¦: http://www.dnew.cn/post/196.htm
ÏÈ¿´ÏÂÏÂÃ漸ÖÖд·¨
1.function f(x){return x*x;};f(x);
2.(function(x){return x*x;})(x);
3.(function(x){return x*x;}(x));
µÚÒ»ÖÖÎÒÃÇÓ¦¸Ã¶¼ºÜÊìϤÁË£¬ÕâÊÇÎÒÃǾ³£Ê¹ÓõÄд·¨¡£µÚ¶þµÚÈýÖÖ¶¼ÊÇÄäÃûº¯ÊýµÄд·¨¡£
------------------------------------------------ ......
¹ØÓÚ
JavaScript
ÕýÔò±í´ï¶ÔÏóµÄʹÓã¬Æä²Î¿¼ÊÖ²á½éÉÜÈçÏ£º
Óï·¨ 1
re = /
pattern
/
[flags
]
Óï·¨ 2
re = new RegExp("
pattern
",
["
flags
"
])
²ÎÊý
re
±ØÑ¡Ïî¡£½«Òª¸³ÖµÎªÕýÔò±í´ïʽģʽµÄ±äÁ¿Ãû¡£
Pattern
±ØÑ¡ÏҪʹÓõÄÕýÔò±í´ïʽģʽ¡£Èç¹ûʹÓÃÓï·¨ 1
£¬Óà &q ......