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

JavaScript Ñ­»·

JavaScript For Ñ­»·
Previous Page
Next Page
JavaScript ÖеÄÑ­»·ÓÃÀ´½«Í¬Ò»¶Î´úÂëÖ´ÐÐÖ¸¶¨µÄ´ÎÊý£¨»òÕßµ±Ö¸¶¨µÄÌõ¼þΪ true ʱ£©¡£
ʵÀý
For Ñ­»· ÈçºÎ±àд loop Ñ­»·À´°´ÕÕÖ¸¶¨µÄ´ÎÊýÖ´ÐÐÏàͬµÄ´úÂë¡£ Ñ­»·²úÉú HTML ±êÌâ ÈçºÎʹÓÃLoopÑ­»·À´²úÉú²»Í¬µÄHTML±êÌâ¡£
JavaScript Ñ­»·
ÔÚ±àд´úÂëʱ£¬Äã³£³£Ï£Íû·´¸´Ö´ÐÐͬһ¶Î´úÂë¡£ÎÒÃÇ¿ÉÒÔʹÓÃÑ­»·À´Íê³ÉÕâ¸ö¹¦ÄÜ£¬ÕâÑù¾ÍÓò»×ÅÖØ¸´µØÐ´Èô¸ÉÐÐÏàͬµÄ´úÂë¡£
JavaScript ÓÐÁ½ÖÖ²»Í¬ÖÖÀàµÄÑ­»·£º
for ½«Ò»¶Î´úÂëÑ­»·Ö´ÐÐÖ¸¶¨µÄ´ÎÊý while µ±Ö¸¶¨µÄÌõ¼þΪ true ʱѭ»·Ö´ÐдúÂë
for Ñ­»·
Ôڽű¾µÄÔËÐдÎÊýÒÑÈ·¶¨µÄÇé¿öÏÂʹÓà for Ñ­»·¡£
Óï·¨£º
for (±äÁ¿=¿ªÊ¼Öµ;±äÁ¿<=½áÊøÖµ;±äÁ¿=±äÁ¿+²½½øÖµ)
{
ÐèÖ´ÐеĴúÂë
}
ʵÀý£º
½âÊÍ£ºÏÂÃæµÄÀý×Ó¶¨ÒåÁËÒ»¸öÑ­»·³ÌÐò£¬Õâ¸ö³ÌÐòÖÐ i µÄÆðʼֵΪ 0¡£Ã¿Ö´ÐÐÒ»´ÎÑ­»·£¬i µÄÖµ¾Í»áÀÛ¼ÓÒ»´Î 1£¬Ñ­»·»áÒ»Ö±ÔËÐÐÏÂÈ¥£¬Ö±µ½ i µÈÓÚ 10 Ϊֹ¡£
×¢ÊÍ£º²½½øÖµ¿ÉÒÔΪ¸º¡£Èç¹û²½½øÖµÎª¸º£¬ÐèÒªµ÷Õû for ÉùÃ÷ÖеıȽÏÔËËã·û¡£
<html>
<body>
<script type="text/javascript">
var i=0
for (i=0;i<=10;i++)
{
document.write("The number is " + i)
document.write("<br />")
}
</script>
</body>
</html>
½á¹û£º
The number is 0
The number is 1
The number is 2
The number is 3
The number is 4
The number is 5
The number is 6
The number is 7
The number is 8
The number is 9
The number is 10
while Ñ­»·


Ïà¹ØÎĵµ£º

Ïêϸ½â¶ÁJavaScriptµÄthis¹Ø¼ü×Ö


ÓÃÁ˺ܾÃJavaScript£¬¶Ô¡¾this¡¿µÄÈÏʶֻ¾ÖÏÞÓÚÒÔÍùµÄƾ¾­Ñé¶øÒÑ£¬²»¹ý½ñÌì·¢ÏÖÁ˺ö«Î÷“http://www.quirksmode.org/js/associative.html”£¬ÏêϸÃèÊöÁËÈçºÎʹÓá¾this¡¿¹Ø¼ü×Ö£¬ÔÚÕâÀïÎҾͼò¶ÌµÄ˵һÏÂÖØµã£¬Èç¹ûÓÐÒÉÎÊ¿ÉÒÔÖ±½Ó²Î¿¼Ô­ÎÄ¡£
ÔÚѧϰ¹ýÓÐthisµÄ±à³ÌÓïÑÔÖУ¬thisÒ»°ã¶¼ÊÇÖ¸Ïòµ±Ç°ÊµÀý¶ÔÏóµÄ£¬¶ÔÓ ......

ѧϰ¡¶JavaScript¸ß¼¶³ÌÐòÉè¼Æ¡·Ñ§Ï°±Ê¼Ç£¨Èý£©

µÚÈýÕ   ¶ÔÏó»ù´¡
      ÔÚjavaScriptÖУ¬¶ÔÏóÊÇÎÞÌØ¶¨Ë³ÐòµÄÖµµÄÊý×é¡£
Ò»¡¢¶ÔÏóµÄÀàÐÍ
    ·ÖΪ±¾µØ¶ÔÏó¡¢ÄÚÖöÔÏóºÍËÞÖ÷¶ÔÏóÈýÖÖ£¬ÆäÖÐÄÚÖöÔÏóÒ²ÊôÓÚ±¾µØ¶ÔÏó¡£
¶þ¡¢±¾µØ¶ÔÏó£º
    1¡¢ArrayÀ࣬Êý×éÀà¡£
      ......

JavaScriptÖÐArray£¨Êý×飩µÄÊôÐԺͷ½·¨

Êý×éÓÐËÄÖÖ¶¨ÒåµÄ·½Ê½
ʹÓù¹Ô캯Êý£º
var a = new Array();
var b = new Array(8);
var c =
new Array("first", "second", "third");
»òÕßÊý×éÖ±½ÓÁ¿£º
var d = ["first",
"second", "third"];
ÊôÐÔ
ArrayÖ»ÓÐÒ»¸öÊôÐÔ£¬¾ÍÊÇlength£¬length±íʾµ ......

JavaScript prototypeµÄÌå»á


    ÔÚJavaScriptÖÐÔ­Ð;ÍÏ൱ÓÚjavaÖеÄÀඨÒ壬ÿ¸öJavaScriptʵÀý¶ÔÏó¶¼»á°üº¬Ô­ÐÍÖж¨ÒåµÄÊôÐÔÓë·½·¨¡£
   ÔÚ±àд¹¹Ô캯Êýʱ£¬¿ÉÒÔʹÓÃÔ­ÐͶÔÏó£¨Ëü±¾ÉíÊÇËùÓй¹Ô캯ÊýµÄÒ»¸öÊôÐÔ£©µÄÊôÐÔÀ´´´½¨¼Ì³ÐÊôÐԺ͹²Ïí·½·¨¡£
Ô­ÐÍÊôÐԺͷ½·¨½«°´ÒýÓø´ÖƸøÀàÖеÄÿ¸ö¶ÔÏó£¬Òò´ËËüÃǶ¼¾ßÓÐÏàͬµÄÖµ ......

JavaScript»ñÈ¡¿Í»§¶ËIP


<!--JavaScript»ñÈ¡¿Í»§¶ËIP-->
<script type="text/javascript" language="javascript">
<!--
function GetLocalIPAddress()
{
    var obj = null;
    var rslt = "";
    try
    {
        ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ