JS+CSS實(shí)現(xiàn)電子商務(wù)網(wǎng)站導(dǎo)航模板效果代碼
本文實(shí)例講述了JS+CSS實(shí)現(xiàn)電子商務(wù)網(wǎng)站導(dǎo)航模板效果代碼。分享給大家供大家參考。具體如下:
這是一款JS+CSS實(shí)現(xiàn)的電子商務(wù)網(wǎng)站導(dǎo)航模板,二級(jí)導(dǎo)航菜單,超強(qiáng)美化,超強(qiáng)實(shí)用性,分享給大家。
運(yùn)行效果截圖如下:

在線演示地址如下:
http://demo.jb51.net/js/2015/js-css-dzsw-wen-nav-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">
<TITLE>適合電子商務(wù)網(wǎng)站CSS導(dǎo)航模板版</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<style>
BODY {
}
UL {
LIST-STYLE-TYPE: none;
padding:0px;
margin:0px;
}
LI {
FONT-SIZE: 12px;
COLOR: #333;
LINE-HEIGHT: 1.5em;
FONT-FAMILY: "宋體", Arial, Verdana;
}
.hide {
DISPLAY: none
}
#mainmenu_top UL LI .menuhover {
BACKGROUND: url(images/mainmenu_s.gif) no-repeat;
COLOR: #fff;
}
#mainmenu_body
{
margin-top:100px;
}
#mainmenu_top UL LI A {
MARGIN-TOP: 2px;
CURSOR: pointer;
PADDING-TOP: 8px;
HEIGHT: 20px;
text-decoration: none;
}
#mainmenu_top {
width:100%;
HEIGHT: 28px;
display:block;
overflow:hidden;
}
#mainmenu_top UL LI {FLOAT: left}
#mainmenu_top UL LI A {
WIDTH: 81px;
height:auto;
DISPLAY: block;
COLOR: #666666;
TEXT-ALIGN: center;
FONT-WEIGHT: bold;
BACKGROUND: url(images/mainmenu_h.gif) no-repeat;
}
#mainmenu_bottom {
width:100%;
height:32px;
line-height:32px;
display:block;
overflow:hidden;
BACKGROUND: url(images/mainmenu_bg.jpg) repeat-x
}
#mainmenu_bottom .mainmenu_rbg {
HEIGHT: 32px;
COLOR: #fff;
MARGIN-LEFT: 0px;
PADDING: 0px 0px 0px 5px;
BACKGROUND: url(images/mainmenu_r.gif) no-repeat right 50%;
}
#mainmenu_bottom UL {}
#mainmenu_bottom UL LI {
PADDING-LEFT: 8px;
FLOAT: left;
MARGIN-LEFT: 7px;
HEIGHT: 32px;
}
#mainmenu_bottom UL LI.se {
FLOAT: left;
MARGIN-LEFT: 7px;
HEIGHT: 32px;
PADDING-LEFT: 8px;
BACKGROUND: url(images/menulink_bg_l.gif) no-repeat;
}
#mainmenu_bottom UL LI A {
COLOR: #fff;
LINE-HEIGHT: 32px;
PADDING-RIGHT: 18px;
DISPLAY: block;
text-decoration: none;
BACKGROUND: url(images/menulink_bg_normal.gif) no-repeat right 50%;
}
#mainmenu_bottom UL LI A:hover {
BACKGROUND: url(images/menulink_bg_normal.gif) no-repeat right 50%;
color: #FFCC00;
}
#mainmenu_bottom UL LI A.se {
COLOR: #fff;
LINE-HEIGHT: 32px;
PADDING-RIGHT: 18px;
DISPLAY: block;
BACKGROUND: url(images/menulink_bg_r.gif) no-repeat right 50%;
}
</style>
<SCRIPT type=text/javascript>
var waitting = 1;
var secondLeft = waitting;
var timer;
var sourceObj;
var number;
function getObject(objectId)//獲取id的函數(shù)
{
if(document.getElementById && document.getElementById(objectId)) {
// W3C DOM
return document.getElementById(objectId);
} else if (document.all && document.all(objectId)) {
// MSIE 4 DOM
return document.all(objectId);
} else if (document.layers && document.layers[objectId]) {
// NN 4 DOM.. note: this won't find nested layers
return document.layers[objectId];
} else {
return false;
}
}
function SetTimer()//主導(dǎo)航時(shí)間延遲的函數(shù)
{
for(j=1; j <10; j++){
if (j == number){
if(getObject("mm"+j)!=false){
getObject("mm"+ number).className = "menuhover";
getObject("mb"+ number).className = "";
}
}
else{
if(getObject("mm"+j)!=false){
getObject("mm"+ j).className = "";
getObject("mb"+ j).className = "hide";
}
}
}
}
function CheckTime()//設(shè)置時(shí)間延遲后
{
secondLeft--;
if ( secondLeft == 0 )
{
clearInterval(timer);
SetTimer();
}
}
function showM(thisobj,Num)//主導(dǎo)航鼠標(biāo)滑過函數(shù),帶時(shí)間延遲
{
number = Num;
sourceObj = thisobj;
secondLeft = 1;
timer = setTimeout('CheckTime()',100);
}
function OnMouseLeft()//主導(dǎo)航鼠標(biāo)移出函數(shù),清除時(shí)間函數(shù)
{
clearInterval(timer);
}
</SCRIPT>
<!--導(dǎo)航開始-->
<DIV id=mainmenu_body>
<!--主導(dǎo)航開始-->
<DIV id=mainmenu_top>
<UL>
<LI><A id=mm1 onmouseover=showM(this,1); onmouseout=OnMouseLeft(); href="#" target=_parent>網(wǎng)站首頁</A> </LI>
<LI><A id=mm2 onmouseover=showM(this,2); onmouseout=OnMouseLeft(); href="#" target=_parent>CCS導(dǎo)航</A> </LI>
<LI><A id=mm3 onmouseover=showM(this,3); onmouseout=OnMouseLeft(); href="#" target=_parent>源碼下載</A> </LI>
<LI><A id=mm4 onmouseover=showM(this,4); onmouseout=OnMouseLeft(); href="#" target=_parent>CSS模板</A> </LI>
<LI><A id=mm5 onmouseover=showM(this,5); onmouseout=OnMouseLeft(); href="#" target=_parent>后臺(tái)模板</A> </LI>
<LI><A id=mm6 onmouseover=showM(this,6); onmouseout=OnMouseLeft(); href="#" target=_parent>CSS技巧</A> </LI>
<LI><A id=mm7 onmouseover=showM(this,7); onmouseout=OnMouseLeft(); href="#" target=_parent>CSS菜單</A> </LI>
<LI style="DISPLAY: none"><A id=mm8 onmouseover=showM(this,8); onmouseout=OnMouseLeft(); href="#" target=_parent>HTML+CSS模板</A> </LI>
<LI><A id=mm9 onmouseover=showM(this,9); onmouseout=OnMouseLeft(); href="#" target=_parent>SEO優(yōu)化</A> </LI></UL>
</DIV>
<!--子導(dǎo)航導(dǎo)航開始-->
<DIV id=mainmenu_bottom>
<DIV class=mainmenu_rbg>
<UL class=hide id=mb1>
<LI><A href="#">本導(dǎo)航非常適合于分類比較多電子商務(wù)站等網(wǎng)站的導(dǎo)航模板版</A> </LI>
<LI><A href="#">此導(dǎo)航很漂亮</A> </LI>
</UL>
<UL class=hide id=mb2>
<LI style="DISPLAY: none"><A href="#" target=_parent>免費(fèi)模板網(wǎng)</A> </LI>
<LI><A href="#" target=_parent>免費(fèi)模板網(wǎng)</A> </LI>
<LI><A href="#" target=_parent>HTML+CSS模板</A> </LI>
<LI><A href="#" target=_parent>HTML+CSS模板</A> </LI>
<LI><A href="#" target=_parent>HTML+CSS教程</A> </LI>
<LI><A href="#" target=_parent>網(wǎng)頁特效</A> </LI></UL>
<UL class=hide id=mb3>
<LI style="DISPLAY: none"><A href="#" target=_parent>免費(fèi)模板網(wǎng)</A> </LI>
<LI style="MARGIN-LEFT: 7px"><A href="#" target=_parent>免費(fèi)模板網(wǎng)</A> </LI>
<LI><A href="#" target=_parent>網(wǎng)上商城</A> </LI>
<LI><A href="#" target=_parent>網(wǎng)上商城</A> </LI>
<LI><A href="#" target=_parent>MYSQL數(shù)據(jù)庫</A> </LI>
<LI><A href="#" target=_parent>MYSQL數(shù)據(jù)庫</A> </LI>
<LI><A href="#" target=_parent>電子商務(wù)</A> </LI>
<LI><A href="#" target=_parent>網(wǎng)頁特效</A> </LI></UL>
<UL class=hide id=mb4>
<LI style="DISPLAY: none; MARGIN-LEFT: 80px"><A href="#" target=_parent>免費(fèi)模板網(wǎng)首頁</A> </LI>
<LI style="MARGIN-LEFT: 80px"><A href="#" target=_parent>網(wǎng)頁特效</A> </LI>
<LI><A href="#" target=_parent>MYSQL數(shù)據(jù)庫</A> </LI>
<LI><A href="#" target=_parent>MSSQL數(shù)據(jù)庫</A> </LI></UL>
<UL class=hide id=mb5>
<LI style="DISPLAY: none"><A href="#" target=_parent>服務(wù)器租用首頁</A> </LI>
<LI style="MARGIN-LEFT: 80px"><A href="#" target=_parent>服務(wù)器租用首頁</A> </LI>
<LI><A href="#" target=_parent>服務(wù)器租用</A> </LI>
<LI><A href="#" target=_parent>服務(wù)器托管</A> </LI>
<LI><A href="#" target=_parent>超級(jí)機(jī)房</A> </LI>
<LI><A href="#" target=_parent>CDN加速設(shè)施</A> </LI></UL>
<UL class=hide id=mb6>
<LI style="DISPLAY: none"><A href="#" target=_parent>企業(yè)郵局首頁</A> </LI>
<LI style="MARGIN-LEFT: 160px"><A href="#" target=_parent>企業(yè)郵局首頁</A> </LI>
<LI><A href="#" target=_parent>綠色G級(jí)郵箱</A> </LI>
<LI><A href="#" target=_parent>綠色企業(yè)郵箱</A> </LI></UL>
<UL class=hide id=mb7>
<LI style="DISPLAY: none"><A href="#" target=_parent>網(wǎng)站制作首頁</A> </LI>
<LI style="MARGIN-LEFT: 180px"><A href="#" target=_parent>企業(yè)建站</A> </LI>
<LI><A href="#" target=_parent>商城制作</A> </LI>
<LI><A href="#" target=_parent>個(gè)人建站</A> </LI>
<LI><A href="#" target=_parent>門戶建站</A> </LI></UL>
<UL class=hide id=mb8 style="DISPLAY: none">
<LI style="MARGIN-LEFT: 270px"><A href="#" target=_parent>代理加盟</A> </LI>
<LI><A href="#" target=_parent>代理加盟</A> </LI>
<LI><A href="#" target=_parent>代理加盟</A> </LI></UL>
<UL class=hide id=mb9>
<LI style="MARGIN-LEFT: 180px"><A href="#">代理加盟</A> </LI>
<LI><A href="#" target=_parent>聯(lián)系我們</A> </LI>
<LI><A href="#" target=_parent>本站通知</A> </LI>
<LI><A href="#" target=_parent>行業(yè)新聞</A> </LI>
<LI><A href="#" target=_parent>誠聘英才</A> </LI></UL>
<script>
function mmenuURL()//主導(dǎo)航、二級(jí)導(dǎo)航顯示函數(shù)
{
var thisURL = document.URL;
tmpUPage = thisURL.split( "/" );
thisUPage_s = tmpUPage[ tmpUPage.length-2 ];
thisUPage_s= thisUPage_s.toLowerCase();//小寫
//thisUPage=thisUPage.substring(0,4)
if(thisUPage_s=="test.jb51.net"||thisUPage_s=="www.dbjr.com.cn"||thisUPage_s=="demo.jb51.net")
{
getObject("mm1").className="menuhover"
getObject("mb1").className = "";
}
else if(thisUPage_s=="domain")
{
getObject("mm2").className="menuhover"
getObject("mb2").className = "";
}
else if(thisUPage_s=="hosting")
{
getObject("mm3").className="menuhover"
getObject("mb3").className = "";
}
else if(thisUPage_s=="mail")
{
getObject("mm4").className="menuhover"
getObject("mb4").className = "";
}
else if(thisUPage_s=="solutions"||thisUPage_s=="site"){
getObject("mm5").className="menuhover"
getObject("mb5").className = "";
}
else if(thisUPage_s=="promotion"){
getObject("mm6").className="menuhover"
getObject("mb6").className = "";
}
else if(thisUPage_s=="trade"||thisUPage_s=="phonetic"||thisUPage_s=="switchboard"||thisUPage_s=="note"){
getObject("mm7").className="menuhover"
getObject("mb7").className = "";
}
else if(thisUPage_s=="benefit"){
getObject("mm8").className="menuhover"
getObject("mb8").className = "";
}
else if(thisUPage_s=="userlogon"||thisUPage_s=="domain_service"||thisUPage_s=="hosting_service"||thisUPage_s=="mail_service"||thisUPage_s=="Payed"||thisUPage_s=="unPayed"||thisUPage_s=="Invoice"||thisUPage_s=="Finance"||thisUPage_s=="RegInfoModify"){
getObject("mm9").className="menuhover"
getObject("mb9").className = "";
}
else
{
getObject("mm1").className="";
getObject("mb1").className = "";
}
}
window.load=mmenuURL()
</script>
</DIV>
</DIV>
</DIV>
</body>
</html>
希望本文所述對(duì)大家的JavaScript程序設(shè)計(jì)有所幫助。
- CSS3+Js實(shí)現(xiàn)響應(yīng)式導(dǎo)航條
- 仿客齊集首頁導(dǎo)航條DIV+CSS+JS [代碼實(shí)例]
- JS+CSS實(shí)現(xiàn)簡(jiǎn)單的二級(jí)下拉導(dǎo)航菜單效果
- JS+CSS實(shí)現(xiàn)鼠標(biāo)滑過時(shí)動(dòng)態(tài)翻滾的導(dǎo)航條效果
- js+css實(shí)現(xiàn)導(dǎo)航效果實(shí)例
- 一步步教大家編寫酷炫的導(dǎo)航欄js+css實(shí)現(xiàn)
- JS+CSS實(shí)現(xiàn)精美的二級(jí)導(dǎo)航效果代碼
- JS+CSS實(shí)現(xiàn)大氣的黑色首頁導(dǎo)航菜單效果代碼
- JS+CSS實(shí)現(xiàn)另類帶提示效果的豎向?qū)Ш讲藛?/a>
- 利用Js+Css實(shí)現(xiàn)折紙動(dòng)態(tài)導(dǎo)航效果實(shí)例源碼
相關(guān)文章
使用原生js+canvas實(shí)現(xiàn)模擬心電圖的實(shí)例
下面小編就為大家?guī)硪黄褂迷鷍s+canvas實(shí)現(xiàn)模擬心電圖的實(shí)例。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-09-09
javascript提取URL的搜索字符串中的參數(shù)(自定義函數(shù)實(shí)現(xiàn))
我們經(jīng)常會(huì)看到有的頁面鏈接地址后面會(huì)跟有參數(shù),很多時(shí)候我們需要獲得這些參數(shù)的值,接下來將介紹獲取方法,感興趣的朋友可以了解系,希望本文對(duì)你有所幫助2013-01-01
微信小程序中如何實(shí)現(xiàn)動(dòng)態(tài)改變SVG顏色和尺寸
SVG可被非常多的工具讀取和修改SVG與JPEG和GIF圖像比起來,尺寸更小,且可壓縮性更強(qiáng),下面這篇文章主要給大家介紹了關(guān)于微信小程序中如何實(shí)現(xiàn)動(dòng)態(tài)改變SVG顏色和尺寸的相關(guān)資料,需要的朋友可以參考下2022-07-07
JavaScript實(shí)現(xiàn)瀑布動(dòng)畫
這篇文章主要為大家詳細(xì)介紹了JavaScript實(shí)現(xiàn)瀑布動(dòng)畫,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2022-06-06
JavaScript中的50+個(gè)實(shí)用工具函數(shù)小結(jié)
JavaScript可以做很多出色的事情,本篇文章給大家整理50+個(gè)實(shí)用工具函數(shù),可以幫助你提高工作效率并可以幫助調(diào)試代碼,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2021-06-06
JavaScript實(shí)現(xiàn)自動(dòng)對(duì)頁面上敏感詞進(jìn)行屏蔽的方法
這篇文章主要介紹了JavaScript實(shí)現(xiàn)自動(dòng)對(duì)頁面上敏感詞進(jìn)行屏蔽的方法,涉及javascript針對(duì)頁面字符串查找及替換的相關(guān)技巧,需要的朋友可以參考下2015-07-07
webpack cjs運(yùn)行時(shí)分析示例詳解
這篇文章主要介紹了webpack cjs運(yùn)行時(shí)分析,本文結(jié)合示例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2022-12-12

