JS實(shí)現(xiàn)自動(dòng)變化的導(dǎo)航菜單效果代碼
本文實(shí)例講述了JS實(shí)現(xiàn)自動(dòng)變化的導(dǎo)航菜單效果代碼。分享給大家供大家參考。具體如下:
自動(dòng)變化的JS導(dǎo)航菜單,按照時(shí)間自動(dòng)切換,有需要的參考一下。
運(yùn)行效果截圖如下:
在線演示地址如下:
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>導(dǎo)航菜單</title> </head> <body> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin site = "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="">時(shí)間類</option> <option value="time">time</option> </select> <select name=menu2> <option value="">哪個(gè)</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.dbjr.com.cn.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>
希望本文所述對(duì)大家的JavaScript程序設(shè)計(jì)有所幫助。
- JS實(shí)現(xiàn)帶圓弧背景漸變效果的導(dǎo)航菜單代碼
- JS+CSS實(shí)現(xiàn)簡(jiǎn)單的二級(jí)下拉導(dǎo)航菜單效果
- JS實(shí)現(xiàn)黑色大氣的二級(jí)導(dǎo)航菜單效果
- JS實(shí)現(xiàn)帶有抽屜效果的產(chǎn)品類網(wǎng)站多級(jí)導(dǎo)航菜單代碼
- JS+CSS實(shí)現(xiàn)大氣的黑色首頁導(dǎo)航菜單效果代碼
- js實(shí)現(xiàn)的動(dòng)畫導(dǎo)航菜單效果代碼
- 基于dropdown.js實(shí)現(xiàn)的兩款美觀大氣的二級(jí)導(dǎo)航菜單
- js實(shí)現(xiàn)仿愛微網(wǎng)兩級(jí)導(dǎo)航菜單效果代碼
- JS實(shí)現(xiàn)的簡(jiǎn)潔二級(jí)導(dǎo)航菜單雛形效果
相關(guān)文章
JavaScript獲取上傳進(jìn)度的幾種方式實(shí)現(xiàn)
進(jìn)度條的應(yīng)用是為了顯示的告訴用戶文件上傳了多少,本文主要介紹了JavaScript獲取上傳進(jìn)度的幾種方式,對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2023-08-08JS數(shù)組索引檢測(cè)中的數(shù)據(jù)類型問題詳解
這篇文章主要給大家介紹了關(guān)于JS數(shù)組索引檢測(cè)中的數(shù)據(jù)類型問題的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2021-01-01js獲取當(dāng)前頁的URL與window.location.href簡(jiǎn)單方法
下面小編就為大家?guī)硪黄猨s獲取當(dāng)前頁的URL與window.location.href簡(jiǎn)單方法。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-02-02