JS實現自動變化的導覽功能表效果代碼,js導覽功能表

來源:互聯網
上載者:User

JS實現自動變化的導覽功能表效果代碼,js導覽功能表

本文執行個體講述了JS實現自動變化的導覽功能表效果代碼。分享給大家供大家參考。具體如下:

自動變化的JS導覽功能表,按照時間自動切換,有需要的參考一下。

運行效果如下:

線上示範地址如下:

http://demo.jb51.net/js/2015/js-auto-cha-nav-menu-style-codes/

具體代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>導覽功能表</title></head><body><SCRIPT LANGUAGE="JavaScript"><!-- Beginsite = "http://www.qq.com"; // Do not include the final "/"function combineMenus(frm, menu1, menu2) {with (frm) {str = menu1.options[menu1.selectedIndex].value;str += menu2.options[menu2.selectedIndex].value;url = site + "/" + str + ".htm";window.location.href = url;  }}// End --></script><form name=menufrm><select name=menu1><option value="">時間類</option><option value="time">time</option></select><select name=menu2><option value="">哪個</option><option value="1">1</option><option value="2">2</option><option value="3">3</option></select><input type=button value="Select" onClick="combineMenus(this.form, this.form.menu1, this.form.menu2)"></form> <SCRIPT LANGUAGE="JavaScript">function makeArray(q){for(i=1 ; i < q ; i++){this[i]=0}}w=1;howmanysites=4; // How many sites are listed below?Sites = new makeArray(howmanysites);Sites[1] = "http://www.bkjia.com.com~JavaScript Planet|Hundreds of JavaScripts!";Sites[2] = "http://www.baidu.com/dhtml~dHTML Scripts|Free dHTML Scripts!";Sites[3] = "http://www.163.com~Altavista|The best search engine";Sites[4] = "http://www.qq.com~Dynamic Drive|More dHTML Scripts";function showSites() {if (w > howmanysites) { w=1; };var string=Sites[w] + "";var split1=string.indexOf("~");var split2=string.indexOf("|");var url=string.substring(0,split1);var name=string.substring(split1 + 1,split2);var word=string.substring(split2 + 1,string.length);document.form.url.value=url;document.form.name.value=name;document.form.word.value=word;w+=1;window.setTimeout('showSites()',3000);}function visitSite() {window.location=document.form.url.value;}</SCRIPT><form name=form><table><tr><td align=center><input type=button name=name value="Visit" onClick="visitSite()" size=25><input type=hidden name=url value=""><input type=text name=word value="" size=40></td></tr></table></form></center><script>showSites();</script></body></html>

希望本文所述對大家的JavaScript程式設計有所協助。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.