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 Ñ»·
Ïà¹ØÎĵµ£º
ÔçÉÏÔÚcsdnÉÏ¿´ÓÐÈËÎÊÒ³Ãæstyle sheetÔõôÐÞ¸ÄÀïÃæµÄrule,¾ÍдÁ˸öÀà,¸ÃÀà¶Ô¼æÈÝFFºÍIE×öÁË´¦Àí¡£
/**//*--------------------------------------------
ÃèÊö : Ìí¼ÓеÄÑùʽrule
²ÎÊý : styleSheetsË÷Òý
´úÂë :&nb ......
Dojo
Ò»¸öÇ¿´óµÄÃæÏò¶ÔÏójavascript¿ò¼Ü¡£
Ö÷ÒªÓÉÈý´óÄ£¿é×é³É£ºCore¡¢Dijit¡¢DojoX¡£
CoreÌṩ Ajax£¬events£¬packaging£¬CSS-based querying£¬animations£¬JSONµÈÏà¹Ø²Ù×÷API¡£
Dijit ......
Êý×éÓÐËÄÖÖ¶¨ÒåµÄ·½Ê½
ʹÓù¹Ô캯Êý£º
var a = new Array();
var b = new Array(8);
var c =
new Array("first", "second", "third");
»òÕßÊý×éÖ±½ÓÁ¿£º
var d = ["first",
"second", "third"];
ÊôÐÔ
ArrayÖ»ÓÐÒ»¸öÊôÐÔ£¬¾ÍÊÇlength£¬length±íʾµ ......