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

[±Ð¾Ç] (±Ð¾Ç²Ä20½g)ºô­¶»Pªí³æ ¤W½g

[±Ð¾Ç] (±Ð¾Ç²Ä20½g)ºô­¶»Pªí³æ ¤W½g

ªí³æ(Form)¬O¤@­Ó¶°¦X¦Wµü¡Aªí³æ¤ºÁÙ¦³³\¦hªº¤¸¥ó¡A¨Ò¦p¡G«ö¶s¡B¤å¦r¤è¶ô¡Kµ¥µ¥¡C

ªí³æ¬Oºô­¶¤¤ªº¤¸¥ó¡A¦b¤@­Óºô­¶¤¤¥i¥H¥]§t¦h­Óªí³æ¡A¦Ó¤@­Óªí³æ¤¤¤S¥i¥H¥]§t«Ü¦h¤£¦PÃþ«¬ªºªí³æ¤¸¥ó¡A¦pªG§Ú­Ì­n¨ú¥Îºô­¶¤¤¬Y­Óªí³æ¤¸¥ó¡A§Ú­Ì¥²¶·©ú½Tªº¥Xªí³æ¤¸¥óªº¦WºÙ¡A¥¿½Tªº»¡ªkÀ³¸Ó¬O¡G«ü¥X¦ì©ó­þ¤@­Óªí³æ¤¤ªº­þ¤@­Óªí³æ¤¸¥ó¡I¤¸¥óªº¦WºÙ¡H·í§Ú­Ì¦b¨Ï¥ÎHTML¼ÐÅҫإߺô­¶¤¸¥ó®É¥ÑNameÄÝ©Ê©Ò¨M©wªº¸ê®Æ­È´N¬O¥¦ªº¦WºÙ¡C


¨ú¥Îªí³æ¤¸¥ó
¦pªG¡A§Ú­Ì¦³¤@­Óºô­¶¡A¨ä¤å¥ó¤º®e¦p¤U¡G
  1. <HTML>
  2. <HEAD>
  3. <TITLE>ªí³æ</TITLE>
  4. </HEAD>
  5. <BODY>
  6. <form name="oneform">
  7. <input type="button" value="«ö¶s" name="mybutton">
  8. </form>

  9. <form name="twoform">
  10. <input type="text" name="mymeno" size="20">
  11. </form>
  12. </BODY>
  13. </HTML>
½Æ»s¥N½X
¦b³o­Óºô­¶¤¤¡A§Ú­Ì¤À§O«Ø¥ß¤F¨â­Óªí³æ¡G¡uoneform¡v»P¡utwoform¡v¡A¡uoneform¡vªí³æ¤¤§t¦³¤@­Ó«ö¶s¤¸¥ó¡umybutton¡v¡A¦Ó¡utwoform¡vªí³æ¤¤§t¦³¤@­Ó³æ¦æ¤å¦r¿é¤J¤è¶ô¤¸¥ó¡umymeno¡v¡C



°²³]¡A§Ú­Ì²{¦b­n¨ú¦^³æ¦æ¤å¦r¿é¤J¤è¶ô¤¸¥ó¡umymeno¡v¤¤©Ò¿é¤Jªº¸ê®Æ¡A¨º§Ú­Ìªºµ{¦¡±Ô­z¸Ó¦p¦ó¼g¡H§Ú­Ì¤§«e»¡¹L¡Gdocumentª«¥ó«üªº´N¬Oºô­¶¤å¥ó¥»¨­¡A¦]¦¹¡A¦bºô­¶¤¤ªº¥ô¦ó¤¸¥ó´N³£¬Odocumentª«¥óªº¤@³¡¥÷¡C¦Óªí³æ©O¡Hªí³æ¬O¤@¸s¤¸¥óªº¶°¦X¡A©Ò¥H·í§Ú­Ì­n¨ú¥Îdocumentª«¥ó¤¤ªº¤@­Ó¤¸¥ó´N¤´±o³z¹Lªí³æ¡C¦n¤F¡A§Ú­Ì²{¦bª¾¹D¤å¦r¿é¤J¤è¶ô¤¸¥ó¡umymeno¡v¬OÁõÄÝ©óªí³æ¡utwoform¡v¶°¦Xªº¤@­û¡A¦Óªí³æ¤S¥u¬Odocumentª«¥óªº¤@³¡¥÷¡A¦]¦¹­n¦s¨ú³æ¦æ¤å¦r¿é¤J¤è¶ô¤¸¥ó¡umymeno¡v¤¤ªº¸ê®Æ¡A§Ú­Ì´N¥²¶·³o¼Ë¡G¡u§Ú­n¦s¨údocument¤¤twoformªí³æªºmymeno³æ¦æ¤å¦r¿é¤J¤è¶ô¤¸¥ó¤ºªº¸ê®Æ¡v¡A­Y§Q¥ÎJavaScriptµ{¦¡¬O±Ô­z¨Óªí¥Ü¡A«h¦p¤U¦¡¡G
  1. document.twoform.mymeno.value
½Æ»s¥N½X
  1. ºô­¶.ªí³æ¦W.ªí³æ¤¸¥ó¦W.¸ê®Æ(­È)
½Æ»s¥N½X
¹ê§@¾Ç²ß¡G
¦bºô­¶¤¤§G¸m¤@ªí³æ«ö¶s»P³æ¦æ¤å¦r¿é¤J¤è¶ô¤¸¥ó(¦P¤@ªí³æ¶°¦X)¡A¦b³æ¦æ¤å¦r¿é¤J¤è¶ô¤¤¿é¤J¸ê®Æ¨Ã«ö¤Uªí³æ«ö¶s«á¡A§Y±N³æ¦æ¤å¦r¿é¤J¤è¶ô¤¤ªº¸ê®ÆÅã¥Ü©ó°T®§¹ï¸Üµøµ¡¤¤¡C
  1. <HTML>
  2. <HEAD>
  3. <TITLE>ªí³æ</TITLE>
  4. </HEAD>
  5. <BODY>
  6. <SCRIPT LANGUAGE="JavaScript">
  7. function showwindow()
  8. {
  9. alert(document.oneform.mymeno.value)
  10. }
  11. </script>
  12. <form name="oneform">
  13. <input type="button" value="«ö¶s" name="mybutton" onClick="showwindow()">
  14. <input type="text" name="mymeno" size="20">
  15. </form>
  16. </BODY>
  17. </HTML>
½Æ»s¥N½X
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

¤å¦r¤è¶ôÀ³¥Î
¦bªí³æ¥þ³¡ªº¤¸¥ó¸Ì¡A³æ¦æ¤å¦r¿é¤J¤è¶ô¬O³Ì¸g±`¤]³Ì®e©ö¨Ï¥Î¨ìªº¤¸¥ó¡A¤×¨ä¬O§Q¥ÎJavaScript«Ø¥ß°ÊºA®ÄªG®É¡A¦]¬°¥¦ÅýJavaScript¯à§Ö³t¦Ó»´©öªº¦¬¶°ÂsÄýªÌ©Ò¶Ç»¼ªº¸ê®Æ¡A¦Ó·í§Ú­Ì»Ý­n±N¸ê®Æ¿é¥X©óºô­¶¤¤§ó¬O¤è«K¡A·íµM¡A¥Hdocument.write()¤èªk¤]¥i±N¸ê®Æ¿é¥X¦Üºô­¶¤¤¡A¦ý¬O¡Adocument.write()¤èªk¥u¯à¿é¥X¡y©T©w¸ê®Æ¡z¡A¤@¦ý§¹¦¨¿é¥X°Ê§@´NµLªk¦A°µÅܧó¡A¦pªG­n°ÊºA©Êªº±N¸ê®Æ¿é¥X¦Üºô­¶¤¤´N¥²¶·§Q¥Î³æ¦æ¤å¦r¿é¤J¤è¶ô¨Ó©ñ¸mÅܰʩʪº¸ê®Æ¡A¨Ò¦p¡A§Ú­Ì­n¦bºô­¶¤¤©ñ¸m¤@­Ó¤p®ÉÄÁ¡A·í§Ú­Ì¥Hdocument.write()¤èªk¿é¥X®É¶¡¸ê®Æ¦Üºô­¶®É¡A§A±N·|µo²{ºô­¶¤¤¥u·|¥X²{¤@¦¸®É¶¡¸ê®Æ¡G
  1. <HTML>
  2. <HEAD><TITLE>¤p®ÉÄÁ</TITLE></HEAD>
  3. <SCRIPT Language="JavaScript">
  4. //¨ú±o²{¦b®É¶¡¨ç¦¡
  5. function statclock()
  6. {
  7. now = new Date();
  8.     hours = now.getHours()
  9.     minutes = now.getMinutes()
  10.     seconds = now.getSeconds()
  11.     timeValue = (hours >= 12) ? "¤U¤È " : "¤W¤È "
  12.     timeValue += ((hours > 12) ? hours - 12 : hours) + " ÂI"
  13.     timeValue += ((minutes < 10) ? " 0" : " ") + minutes + " ¤À"
  14.     timeValue += ((seconds < 10) ? " 0" : " ") + seconds + " ¬í"
  15. }

  16. //¤p®ÉÄÁ¨ç¦¡
  17. function clocktxt()
  18. {
  19. statclock()
  20. //±N®É¶¡¦r¦ê¸ê®ÆÅã¥Ü©óºô­¶¤¤
  21. document.write(timeValue)
  22. //­«½Æ°õ¦æ¤p®ÉÄÁ¨ç¦¡
  23. setTimeout("clocktxt()", 1000)
  24. }
  25. </SCRIPT>
  26. <!--ºô­¶¸ü¤J®É§Y©I¥sª¬ºA¦C¤p®ÉÄÁ¨ç¦¡-->
  27. <BODY onLoad="clocktxt()">
  28. </BODY>
  29. </HTML>
½Æ»s¥N½X

  • §Ú­Ì¦bºô­¶¶}©l¸ü¤J®É¡]µ{¦¡½X²Ä28¦æ¡^¡A§Q¥ÎOnLoad¨Æ¥ó¨Ó©I¥s¤p®ÉÄÁ¨ç¦¡clocktxt()¨ç¦¡(µ{¦¡½X²Ä18¦æ)¡A¶i¦Ó©óclocktxt()¨ç¦¡¤¤¦A©I¥sstatclock()¨ç¦¡(µ{¦¡½X²Ä20¦æ)¨ú¦^®É¶¡¸ê®Æ¡A±µµÛ±N¸ê®Æ¿é¥X©óºô­¶¤¤¡]µ{¦¡½X²Ä22¦æ¡^¡A¦¹®É¡A®É¶¡¸ê®Æ²Ä¤@¦¸¦¨¥\ªº¿é¥X©óºô­¶¤¤¡C
  • ®É¶¡¸ê®Æ²Ä¤@¦¸¦¨¥\ªº¿é¥X©óºô­¶¤¤«á¡A±µµÛµ{¦¡°õ¦æsetTimeout()¤èªk¡A­«½Æ°õ¦æ©I¥s¤p®ÉÄÁ¨ç¦¡clocktxt()¨ç¦¡¥H«KÅã¥Ü°ÊºAªº®É¶¡¡Aclocktxt()¨ç¦¡¦A¦¸©I¥sstatclock()¨ç¦¡(µ{¦¡½X²Ä20¦æ)¨ú¦^®É¶¡¸ê®Æ¡A±µµÛ­n±N¸ê®Æ¿é¥X©óºô­¶¤¤®É¥X°ÝÃD¤F¡G


«ç·|³o¼Ë¡H¡u¥²¶·­n¦³¤¸¥ó¡v¡H¦]¬°ºô­¶ªº¿é¥X¤@¥¹¦¨«¬¡]§¹¥þ¸ü¤J¡^¡A´N¤£¥i¥H¦A§Q¥Îdocument.write()¤èªk¿é¥X¸ê®Æ¦Üºô­¶¤F¡A°£«D§A¸ê®Æ¿é¥Xªº¥Øªº¦a¬O¤@­Ó¥i°ÊºAÅܧ󤺮e¸ê®Æªº¤¸¥ó¡A¹³¬Oªí³æ¤¸¥ó¡u³æ¦æ¤å¦r¿é¤J¤è¶ô¡v¡Kµ¥¡C

¹ê§@¾Ç²ß¡G
§Q¥Î¡u³æ¦æ¤å¦r¿é¤J¤è¶ô¡v»s§@ºô­¶¤¤ªº¤p®ÉÄÁ¡C
  1. <HTML>
  2. <HEAD><TITLE>¤p®ÉÄÁ</TITLE></HEAD>
  3. <SCRIPT Language="JavaScript">
  4. //Åã¥Ü®É¶¡©ó¤å¦r¤è¶ô¤¤ªº¨ç¦¡
  5. function Show()
  6. {
  7. Digital=new Date()
  8. hours=Digital.getHours()
  9. minutes=Digital.getMinutes()
  10. seconds=Digital.getSeconds()

  11. if (minutes<=9)
  12. {
  13. minutes="0"+minutes
  14. }
  15. if (seconds<=9)
  16. {
  17. seconds="0"+seconds
  18. }
  19. //¦b¤å¦r¤è¶ô¤ºÅã¥Ü®É¶¡
  20. document.Tick.Clock.value=hours+":"+minutes+":"+seconds
  21. setTimeout("Show()",1000)
  22. }
  23. </script>
  24. <BODY onLoad="Show()">

  25. <form name="Tick">
  26. <input type="text" size="12" name="Clock">
  27. </form>

  28. </BODY>
  29. </HTML>
½Æ»s¥N½X



  • µ{¦¡½X²Ä27¦Ü29¦æ¡A§Ú­Ì¦bºô­¶¥DÅé(BODY)¤º¡A«Ø¥ß¤F¤@­Óªí³æ¡uTick¡v¡A¦Ó¦bªí³æ¤º¤S§G¸m¤F¤@­Ó³æ¦æ¤å¦r¤è¶ô¤¸¥ó¡uClock¡v¥Î¨Ó©ñ¸m®É¶¡¸ê®Æ¡A©Ò¥H¡A·í§Ú­Ì­n±N¸ê®Æ©ñ¤J¤å¦r¤è¶ô¤¸¥ó®É¥²¶·¨Ï¥Î¤U¦C®æ¦¡±Ô­z¡G
    1. document.Tick.Clock.value=¡¨¸ê®Æ¡¨
    ½Æ»s¥N½X
  • µ{¦¡½X²Ä7¦æ¡A§Q¥Înew«Øºc¤l«Ø¥ß®É¶¡¤é´Áª«¥ónow()¡C
  • µ{¦¡½X²Ä8¦æ¡A§Q¥Î®É¶¡¤é´Áª«¥óªºgetHours()¤èªkÂ^¨ú®É¶¡¡u¤p®É¡v¡C
  • µ{¦¡½X²Ä9¦æ¡A§Q¥Î®É¶¡¤é´Áª«¥óªºgetMinutes()¤èªkÂ^¨ú®É¶¡¡u¤p®É¡v¡C
  • µ{¦¡½X²Ä10¦æ¡A§Q¥Î®É¶¡¤é´Áª«¥óªºgetSeconds()¤èªkÂ^¨ú®É¶¡¡u¤p®É¡v¡C
  • µ{¦¡½X²Ä12¦æ¡A¬°¤FÅã¥Ü"¨â¦ì¼Æ"ªº¡u¤À¡vÄÁ®É¶¡,©Ò¥H,­Y¨ú±oªº¡u¤À¡vÄÁ®É¶¡¼Æ­È¤p©óµ¥©ó9«h¦b«e¤è¥[¤W"0"¡C
  • µ{¦¡½X²Ä16¦æ¡A¬°¤FÅã¥Ü"¨â¦ì¼Æ"ªº¡u¬í¡v®É¶¡,©Ò¥H,¦pªG¨ú±oªº¡u¬í¡v®É¶¡¼Æ­È¤p©óµ¥©ó9«h¦b«e¤è¥[¤W"0"¡C
  • ¦bºô­¶¶}©l¸ü¤J®É¡]µ{¦¡½X²Ä25¦æ¡^¡A§Q¥ÎOnLoad¨Æ¥ó¨Ó©I¥s¤p®ÉÄÁ¨ç¦¡Show()¨ç¦¡(µ{¦¡½X²Ä5¦æ)¡A¨ú¦^®É¶¡¸ê®Æ¡A±µµÛ±N¸ê®Æ¿é¥X©óºô­¶¤¤ªº³æ¦æ¤å¦r¤è¶ô¤¸¥ó¡uClock¡v¡]µ{¦¡½X²Ä21¦æ¡^¡A¦¹®É¡A®É¶¡¸ê®Æ²Ä¤@¦¸¦¨¥\ªº¿é¥X©óºô­¶¤¤¡C
  • ®É¶¡¸ê®Æ²Ä¤@¦¸¦¨¥\ªº¿é¥X©ó³æ¦æ¤å¦r¤è¶ô¤¸¥ó¡uClock¡v«á¡A±µµÛµ{¦¡°õ¦æsetTimeout()¤èªk¡A­«½Æ°õ¦æ©I¥s¤p®ÉÄÁ¨ç¦¡Show()¥H«K©ó³æ¦æ¤å¦r¤è¶ô¤¸¥ó¡uClock¡v¤¤Åã¥Ü°ÊºAªº®É¶¡¡C
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

TOP

¶i¶¥À³¥Î¡G
§Q¥Î¡u³æ¦æ¤å¦r¿é¤J¤è¶ô¡v»s§@ºô­¶¤¤ªº¶]°¨¿O¡C
  1. <HTML>
  2. <HEAD><TITLE>¶]°¨¿O</TITLE></HEAD>
  3. <SCRIPT Language="JavaScript">
  4. //±N¥X²{ªº°T®§¤å¦r¦r¦ê
  5. msg="³o¬O¤@­Ó²©öªºª¬ºA¦C¶]°¨¿O"
  6. //¹w³]¶}©lÅã¥Üªº¦r¦êªø«×
  7. txt=0
  8. //¶]°¨¿O¨ç¦¡
  9. function pagetxt()
  10. {
  11. //Åã¥Ü«ü©wªø«×ªº°T®§¦r¦ê
  12. document.scrollForm.scrollTxt.value = msg.substring(0, txt+1)
  13. //±NÅã¥Üªº¤å¦rªø«×¥[1
  14. txt=txt+1
  15. //·í§¹¾ãªº°T®§¤å¦rÅã¥Ü§¹²¦«á
  16. //¦A­«·s¶}©l³v¦r¥[¤JÅã¥Ü
  17. if ( txt >= msg.length )
  18. { txt=0 }
  19. //­«½Æ°õ¦æ¨ç¦¡
  20. setTimeout("pagetxt()", 200)
  21. }
  22. </SCRIPT>
  23. <!--ºô­¶¸ü¤J®É§Y©I¥s¶]°¨¿O¨ç¦¡-->
  24. <BODY onLoad="pagetxt()">

  25. <form name="scrollForm">
  26. <input type="text" size="30" name="scrollTxt">
  27. </form>

  28. </BODY>
  29. </HTML>
½Æ»s¥N½X

  • µ{¦¡½X²Ä26¦Ü28¦æ¡A§Ú­Ì¦bºô­¶¥DÅé(BODY)¤º¡A«Ø¥ß¤F¤@­Óªí³æ¡uscrollForm¡v¡A¦Ó¦bªí³æ¤º¤S§G¸m¤F¤@­Ó³æ¦æ¤å¦r¤è¶ô¤¸¥ó¡uscrollTxt¡v¥Î¨Ó©ñ¸m®É¶¡¸ê®Æ¡A©Ò¥H¡A·í§Ú­Ì­n±N¸ê®Æ©ñ¤J¤å¦r¤è¶ô¤¸¥ó®É¥²¶·¨Ï¥Î¤U¦C±Ô­z¡G
    1. document.scrollForm.scrollTxt.value=¡¨¸ê®Æ¡¨
    ½Æ»s¥N½X
  • µ{¦¡½X²Ä12¦æ¡A.substring(begin,end)¡GÂ^¨ú°_©l»Pµ²§ô¼Æ­È¶¡ªº¤å¦r¡C
  • µ{¦¡½X²Ä17¦æ¡Amsg.length¥Nªí¨ú±oÅܼÆmsgªº¦r¤¸ªø«×¡C
  • ¦bºô­¶¶}©l¸ü¤J®É¡]µ{¦¡½X²Ä24¦æ¡^¡A§Q¥ÎOnLoad¨Æ¥ó¨Ó©I¥s¶]°¨¿O¨ç¦¡pagetxt()¨ç¦¡(µ{¦¡½X²Ä9¦æ)¡A±µµÛ±N¸ê®Æ¿é¥X©óºô­¶¤¤ªº³æ¦æ¤å¦r¤è¶ô¤¸¥ó¡uscrollTxt¡v¡]µ{¦¡½X²Ä12¦æ¡^¡C

¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

TOP

¤å¦r¦¡©Ô§â¹CÀ¸

§Q¥Î³æ¦æ¤å¦r¤è¶ô»P¶Ã¼Æ»s§@©Ô§â¹CÀ¸¡C
  1. <HTML>
  2. <HEAD><TITLE>¤å¦r¦¡©Ô§â¹CÀ¸</TITLE></HEAD>
  3. <BODY>

  4. <SCRIPT language="JavaScript">
  5. var count=0
  6. var left,center,right
  7. var delaytime=30

  8. function gamestart(){
  9. var timeA
  10. count++
  11. if(count<11)
  12. {left = parseInt(9 * Math.random()+1)}

  13. if(count<21)
  14. {center = parseInt(9 * Math.random()+1)}

  15. if(count==21 && left==center){
  16. delaytime=100;
  17. document.go.message.value = "Go,Go,Go..........¡I"}

  18. if(count<delaytime)
  19. {right = parseInt(9 * Math.random()+1)}

  20. document.go.Ltext.value = left
  21. document.go.Mtext.value = center
  22. document.go.Rtext.value = right

  23. if (count==delaytime)
  24. {
  25. if (left==center&&left==right)
  26. {
  27. alert("®¥³ß±z¤¤¼ú°Õ¡I")
  28. }
  29. else
  30. {
  31. alert("®t¤@ÂI¡A¦A¥[ªo¡I")
  32. }
  33. count=0
  34. delaytime=31;
  35. document.go.message.value ="½Ð«ö¶}©l«ö¶s±Ò°Ê¹CÀ¸"
  36. }
  37. else{timeA = setTimeout("gamestart()",100)}
  38. }

  39. </SCRIPT>

  40. <FORM name=go>
  41. <center>
  42. <TABLE border=0>
  43. <TR>
  44. <TD><INPUT name=Ltext size=2 value=0 > </TD>
  45. <TD><INPUT name=Mtext size=2 value=0> </TD>
  46. <TD><INPUT name=Rtext size=2 value=0> </TD>
  47. </TABLE>
  48. <INPUT name=message size=20 value=½Ð«ö¶}©l«ö¶s±Ò°Ê¹CÀ¸><br>
  49. <INPUT name=game onclick=gamestart() type=button value=¶}©l> </center>
  50. </FORM>

  51. </BODY>
  52. </HTML>
½Æ»s¥N½X


¶Ã¼Æ¡GMath.random()
Math.random()¬O¤@­ÓJavaScript¤º«Øªº¶Ã¼Æ²£¥Í¾¹¡A¥¦¬O§Q¥Î¨t²Î®É¶¡¦Û¥ÑÀH¾÷²£¥Í¤¶©ó0¦Ü1ªº¶Ã¼Æ¡A¤]´N»¡¥¦¥i¯à²£¥Íªºµ²ªG¡uµLªk¹w´ú¡v¡I
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

TOP

        ÀR«ä¦Û¦b : ­n¥Î¤ß¡A¤£­n¾Þ¤ß¡B·Ð¤ß¡C
ªð¦^¦Cªí ¤W¤@¥DÃD