Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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 ×Ö·û´® substring Óë substr Çø±ð

stringObject.substring(start,end);
º¯Êý·½·¨½«·µ»ØÒ»¸ö°üº¬´Ó start µ½×îºó£¨²»°üº¬ end £©µÄ×Ó×Ö·û´®µÄ×Ö·û´®.
start     ±ØÐè¡£Ò»¸ö·Ç¸ºµÄÕûÊý£¬¹æ¶¨ÒªÌáÈ¡µÄ×Ó´®µÄµÚÒ»¸ö×Ö·ûÔÚ stringObject ÖеÄλÖÃ.
stop     ¿ÉÑ¡¡£Ò»¸ö·Ç¸ºµÄÕûÊý£¬±ÈÒªÌáÈ¡µÄ×Ó´®µÄ×îºóÒ»¸ö×Ö·ûÔÚ stringObject ......

һЩ±È½Ï³£¼ûµÄJavascript¿ò¼Ü¼ò½é

Dojo
      Ò»¸öÇ¿´óµÄÃæÏò¶ÔÏójavascript¿ò¼Ü¡£
      Ö÷ÒªÓÉÈý´óÄ£¿é×é³É£ºCore¡¢Dijit¡¢DojoX¡£
      CoreÌṩ Ajax£¬events£¬packaging£¬CSS-based querying£¬animations£¬JSONµÈÏà¹Ø²Ù×÷API¡£
      Dijit ......

JavaScript prototypeµÄÌå»á


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

ͼƬÎÞ·ì¹ö¶¯´úÂë(DIV+CSS+JavaScript)

<div id="imgbox" style="height:110px;width:600px;overflow:hidden;">
<div id="imgbox1" style="float:left;width:1000%">
<img src="http://www.google.com.hk/intl/zh-CN/images/logo_cn.gif" mce_src="http://www.google.com.hk/intl/zh-CN/images/logo_cn.gif">
<img src="http://www ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ