查看完整版本: 隨機選擇按鈕

14-5-2012 16:27

隨機選擇按鈕

<FONT color=blue>
<P><FONT color=#0000ff size=3>如不能顯示語法效果可貼去本站</FONT><A href="http://www.bunbun000.com/html/index.htm" target=_blank><FONT color=red size=3>語法測試板</FONT></A><FONT color=#0000ff size=3>試看</FONT></P></FONT>
<P><FONT color=blue></FONT>&nbsp;</P>
<P><FONT color=blue></FONT>&nbsp;</P>
<P><FONT color=blue></FONT>&nbsp;</P>
<P><FONT color=blue></FONT>&nbsp;</P>
<P><FONT color=blue>&lt;script&gt;<BR>var count=0<BR>function dothis(){<BR>setTimeout("document.wheel.wheel2.selectedIndex =1000",100)<BR>setTimeout("document.wheel.wheel2.selectedIndex =count",200)<BR>setTimeout("document.wheel.wheel2.selectedIndex =1000",300)<BR>setTimeout("document.wheel.wheel2.selectedIndex =count",400)<BR>setTimeout("document.wheel.wheel2.selectedIndex =1000",500)<BR>setTimeout("document.wheel.wheel2.selectedIndex =count",600)<BR>setTimeout("window.location=document.wheel.wheel2.options[document.wheel.wheel2.selectedIndex].value",800)<BR>}</FONT></P>
<P><FONT color=blue>function animate(){<BR>var countfinal=Math.round(Math.random()*(document.wheel.wheel2.length-1))<BR>document.wheel.wheel2.selectedIndex =count<BR>if (count==countfinal){<BR>dothis()<BR>return<BR>}<BR>if (count&lt;document.wheel.wheel2.length)<BR>count++<BR>else<BR>count=0<BR>setTimeout("animate()",50)<BR>} </FONT></P>
<P><FONT color=blue>&lt;/script&gt;</FONT></P>
<P><FONT color=blue>&lt;form method="POST" name="wheel"&gt;</FONT></P>
<P><FONT color=blue>&nbsp; &lt;div align="center"&gt;&lt;center&gt;&lt;p&gt;&lt;select name="wheel2" size="6"&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;option value="</FONT><A href="http://bunbun000.com/"><FONT color=blue>http://bunbun000.com/</FONT></A><FONT color=blue>"&gt;笨笨網站&lt;/option&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;option value="</FONT><A href="http://www.bunbunhk.com/BBS/Discuz/index.php"><FONT color=blue>http://www.bunbunhk.com/BBS/Discuz/index.php</FONT></A><FONT color=blue>"&gt;笨網論壇&lt;/option&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;option value="</FONT><A href="http://bunbun000.com/home/word/index.htm"><FONT color=blue>http://bunbun000.com/home/word/index.htm</FONT></A><FONT color=blue>"&gt;繁簡轉換&lt;/option&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;option value="</FONT><A href="http://bunbun000.com/home/js.htm"><FONT color=blue>http://bunbun000.com/home/js.htm</FONT></A><FONT color=blue>"&gt;翻譯系統&lt;/option&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;option value="</FONT><A href="http://bunbun000.com/home/travel/index.htm"><FONT color=blue>http://bunbun000.com/home/travel/index.htm</FONT></A><FONT color=blue>"&gt;笨笨遊蹤&lt;/option&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;option value="</FONT><A href="http://www.bunbunhk.com/bg.htm"><FONT color=blue>http://www.bunbunhk.com/bg.htm</FONT></A><FONT color=blue>"&gt;免費資源&lt;/option&gt;<BR>&nbsp; &lt;/select&gt;&lt;/p&gt;<BR>&nbsp; &lt;/center&gt;&lt;/div&gt;&lt;div align="center"&gt;&lt;center&gt;&lt;p&gt;&lt;input type="button" value="按掣隨選"<BR>&nbsp; name="B1" onClick="animate()"&gt;&lt;/p&gt;<BR>&nbsp; &lt;/center&gt;&lt;/div&gt;<BR>&lt;/form&gt;</FONT></P>

25-4-2013 13:16

複製上列語法

<form name="copy">
<textarea cols="40" name="txt" rows="4" style="BACKGROUND-COLOR:#ffffff; COLOR:#000000; FONT-SIZE:9pt">
<script>
var count=0
function dothis(){
setTimeout("document.wheel.wheel2.selectedIndex =1000",100)
setTimeout("document.wheel.wheel2.selectedIndex =count",200)
setTimeout("document.wheel.wheel2.selectedIndex =1000",300)
setTimeout("document.wheel.wheel2.selectedIndex =count",400)
setTimeout("document.wheel.wheel2.selectedIndex =1000",500)
setTimeout("document.wheel.wheel2.selectedIndex =count",600)
setTimeout("window.location=document.wheel.wheel2.options[document.wheel.wheel2.selectedIndex].value",800)
}

function animate(){
var countfinal=Math.round(Math.random()*(document.wheel.wheel2.length-1))
document.wheel.wheel2.selectedIndex =count
if (count==countfinal){
dothis()
return
}
if (count<document.wheel.wheel2.length)
count++
else
count=0
setTimeout("animate()",50)
}

</script>

<form method="POST" name="wheel">

  <div align="center"><center><p><select name="wheel2" size="6">
    <option value="http://bunbun000.com/">笨笨網站</option>
    <option value="http://www.bunbunhk.com/BBS/Discuz/index.php">笨網論壇</option>
    <option value="http://bunbun000.com/home/word/index.htm">繁簡轉換</option>
    <option value="http://bunbun000.com/home/js.htm">翻譯系統</option>
    <option value="http://bunbun000.com/home/travel/index.htm">笨笨遊蹤</option>
    <option value="http://www.bunbunhk.com/bg.htm">免費資源</option>
  </select></p>
  </center></div><div align="center"><center><p><input type="button" value="按掣隨選"
  name="B1" onClick="animate()"></p>
  </center></div>
</form>

</textarea><br>
<input onclick="javascript:this.form.txt.focus();this.form.txt.select();" type="button" value="全選">
</form>

<BR>

<script type="text/javascript"><!--
google_ad_client = "ca-pub-4078143172638881";
/* 336X280 */
google_ad_slot = "3268225205";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
頁: [1]
查看完整版本: 隨機選擇按鈕