ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[±Ð¾Ç] (±Ð¾Ç²Ä3½g)±MÃD¹ê§@¡G¹Ï¤ù¦¡¶i¯¸®É¶¡

[±Ð¾Ç] (±Ð¾Ç²Ä3½g)±MÃD¹ê§@¡G¹Ï¤ù¦¡¶i¯¸®É¶¡


¦b¤W¤@­Ó¨ÒÃD¤¤¡A§Ú­Ì§Q¥Î¤é´Áª«¥óDate()ªºÂ^¨ú¤èªk¡AÂ^¨ú®É¡B¤À¡B¬íµ¥®É¶¡¸ê®Æ¥[¥H§Q¥Î¡A²Õ¦X¥X³æ¯Âªº¶i¯¸ÂsÄý®É¶¡¦r¦ê¡A¡A¦pªG¥u¬OÅã¥Ü¤å¦r¤Ó¨S½ì¤F¡I§Ú­Ì¨Óµy¥[ÅܤƤ@¤U¡A§Q¥Î¹Ï¤ùÅã¥ÜÆ[½àªÌ¶i¯¸®É¶¡¡I
­º¥ý¡A§Ú­Ì¥²¶·¥ý·Ç³ÆÅã¥Ü®É¶¡ªº¹Ï¤ù¡A³o¼Ë¤~¯àÅã¥Ü®É¶¡®@¡I
5.png

.substring(begin,end)¡G¦r¦êÂ^¨ú¤èªk
begin¬°¦r¦êÂ^¨úªº°_©l¦ì¸m¡Aend¬°¦r¦êÂ^¨úªº²×ÂI¦ì¸m
¨Ò¦p¡G§Ú­Ì¦³¤@­ÓÅÜ¼Æ test=¡¦abcdefgh¡¦¡A·í§Ú­Ì¨Ï¥Î¦r¦êÂ^¨úªº¤èªk¨ÓÂ^¨ú¦r¦ê¤¤ªº¬Y¬q¤º®e¡G
  1. X=test.substring(2,5);
½Æ»s¥N½X
½Ð°ÝxÀ³¸Óµ¥©ó¤°»ò¡Hµª®×¬O¡ycde¡z¡I

.length¡G¦r¦êªº¦r¤¸ªø«×ÄÝ©Ê
¨Ò¦p¡G§Ú­Ì¦³¤@­ÓÅÜ¼Æ test=¡¦abcdefgh¡¦¡A·í§Ú­Ì·Qª¾¹D¸Ó¦r¦ê¨Ï¥Î¤F¦h¤Ö¦r¤¸(¦r¤¸ªø«×)¡A«h§Ú­Ì´N¥i¥H§Q¥Î¦r¦êªº¦r¤¸ªø«×ÄÝ©Ê¡G
  1. X=test.length;
½Æ»s¥N½X
½Ð°ÝxÀ³¸Óµ¥©ó¤°»ò¡Hµª®×¬O¡y8¡z¡I§A¼Æ¼Æ¬Ý"abcdefgh"³o­Ó¦r¦ê¦³´X­Ó¦r¥À¡H

.charAt(Value)¤èªk¡G¥H¦r¤¸­p¼ÆÂ^¨ú¦r¦êªº¦r¤¸¦ì¸m¡A½Ðª`·N¡G¡uA¡v¬O¤j¼g³á¡IValue¬°Â^¨ú¦r¤¸ªº°Ñ·Ó­p¼Æ¡C
¨Ò¦p¡G§Ú­Ì¦³¤@­ÓÅÜ¼Æ test=¡¦abcdefgh¡¦¡A·í§Ú­Ì·QÂ^¨ú¸Ó¦r¦ê²Ä¤T­Ó¦ì¸mªº¦r¤¸¥X¨Ó¡A«h§Ú­Ì´N¥i¥H§Q¥Î¤U¦C¦¡¤l¡G
  1. X=test.charAt(3);
½Æ»s¥N½X
½Ð°ÝxÀ³¸Óµ¥©ó¤°»ò¡Hµª®×¬O¡yd¡z¡I«z¡I¡Hµª®×«ç·|¬O¡ud¡v¦Ó¤£¬O¡uc¡v°Ú¡I³o¬O¦]¬°Â^¨ú¦r¦êªº¦r¤¸§Ú­Ì©Òµ¹ªº°Ñ·Ó¦r¤¸­p¼Æ¬O±q¡y0¡z¶}©l¡A¨Ã¤£¬O§Ú­Ì²ßºDªº¥H¡y1¡z¬°¶}©l­p¼Æ¡I­nª`·N³á¡I
  1. <HTML>
  2. <HEAD>
  3. <TITLE>±MÃD¹ê§@¡G¹Ï¤ù¦¡¶i¯¸®É¶¡</TITLE>
  4. </HEAD>
  5. <BODY >

  6. <SCRIPT language="JavaScript">
  7. inTime=new Date()

  8. Hour="0"+inTime.getHours()
  9. Hour=Hour.substring(Hour.length-2,Hour.length)
  10. Hour1=Hour.charAt(1)
  11. Hour0=Hour.charAt(0)

  12. Minute="0"+inTime.getMinutes()
  13. Minute=Minute.substring(Minute.length-2,Minute.length)
  14. Minute1=Minute.charAt(1)
  15. Minute0=Minute.charAt(0)

  16. document.write('<IMG src="'+Hour0+'.gif">')
  17. document.write('<IMG src="'+Hour1+'.gif">')
  18. document.write('<IMG src="x.gif">')
  19. document.write('<IMG src="'+Minute0+'.gif">')
  20. document.write('<IMG src="'+Minute1+'.gif">')
  21. </SCRIPT>

  22. </BODY>
  23. </HTML>
½Æ»s¥N½X
¯S§Oª`·N¡G
1.¦bµ{¦¡½X¤¤ªº¡u+¡v¥[¸¹¦b¥»¨Ò¤¤³£¬O¡y¦ê±µ²Å¸¹¡z¡A¨Ã«Dºâ¼Æ¹Bºâ¤¤ªº¥[ªk¡I
2.¦bµ{¦¡½Xªº²Ä10¦æ»P²Ä15¦æ¤¤¡A§Ú­Ì¬°¦ó­n±NÂ^¨ú¥X¨Óªº¡u®É¡v»P¡u¤À¡v¸ê®Æ¦A¦ê±µ¤W¤@­Ó¡u0¡v¡H¦]¬°·í§Ú­Ì±N¨t²Î®É¶¡ªº®É¶¡Â^¨ú¥X¨Ó«á¦^À³ªº¸ê®Æ¬O¼Æ¦r¡A·í¼Æ¦r¬O2¦ì¼Æ®É¡A¨Ò¦p15ÂI20¤À¡AÂ^¨úÀò±oªº¸ê®Æ¬O¡u15¡v»P¡u20¡v¡A¦b¦¹©Ò±oªº³£¬O¨â¦ì¼Æªº¼Æ¦r¡A¦b¹Ï¤ùÅã¥Ü®É±N·|¬O¡y15;20¡z¡A¦ý­Y¬O15ÂI2¤À¡AÂ^¨úÀò±oªº¸ê®Æ±N¬O¡u15¡v»P¡u2¡v¡A¦b¹Ï¤ùÅã¥Ü®É±N·|¬O¡y15;2¡z¡A¤@­Ó¬O¤­±i¹Ï©Ò²Õ¦X¦Ó¦¨ªºµe­±¡A¥t¤@¬°¥|±i¹Ï©Ò²Õ¦Xªºµe­±¡A³o¼Ë¤£¦Pªºµ²ªG±N·|³y¦¨§Ú­Ìºô­¶¾ãÅéµe­±ªº¤£¨ó½Õ¡A©Ò¥H§Ú­Ì¤~¦bÂ^¨ú¥X¨Óªº¡u®É¡v»P¡u¤À¡v¸ê®Æ¦A¦ê±µ¤W¤@­Ó¡u0¡v¡AÅý©Ò¦³ªº®É¶¡³£¬O¥Ñ¤­±i¹Ï©Ò²Õ¦X¦Ó¦¨ªºµe­±¡I
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

¥»©«³Ì«á¥Ñ ªL´¼«³ ©ó 2014-11-4 01:48 ½s¿è

§Úª¾¹D­ì¦]¤F¡AÁÙ¥¼¿é¥X¡C
§Ú·Q°Ý¡A³o¬q¥X¤F¤°»ò°ÝÃD?
¬°¤°»ò¶}±Ò«á·|¬OªÅ¥Õªº©O?
  1. <html>
  2. <body>
  3. <script language="javascript">
  4. a="abcdefgh";
  5. b=a.substring(2,5);
  6. </script>
  7. </body>
  8. </html>
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¤@­Ó¤Hªº§Ö¼Ö¡D¤£¬O¦]¬°¥L¾Ö¦³±o¦h¡A¦Ó¬O¦]¬°¥L­p¸û±o¤Ö¡C
ªð¦^¦Cªí ¤W¤@¥DÃD