主题:想点击那个栏目名,那个栏目名就变了样式? (只做一个头部导航页面做调用)
<style type="text/css">
<!--
#top2 LI.self A {
BACKGROUND: url(img/nav_bg_current.gif) no-repeat left -40px; COLOR: #fff
}
-->
</style>
<BODY onload='onloadcss()'>
<SCRIPT language=javascript>
var url=location.pathname;//获得url/后的值
var arrdir=url.split("/");//分割url得到数组
dirname=arrdir[1].toString();//取数组的第二个数
function cssstyle(objName,selfname){
if(dirname=="" || dirname=="index.php"){//当前目录是首页时
if (selfname=="index.php")
document.getElementById(objName).className='self';
else
return("");
}
else//不是首页时
{
if (selfname=="")
return("");
else if(dirname==selfname)
document.getElementById(objName).className='self'
}
}
function onloadcss(){
cssstyle("p1","index.php");
cssstyle("p2","search.php");
cssstyle("p3","member.php");
cssstyle("p4","group.php")
cssstyle("p5","brand.php")
cssstyle("p6","cart.php")
cssstyle("p7","goods.php")
cssstyle("p8","page.php")
cssstyle("p9","bbs")
}
</SCRIPT>
<LI class=mouseout id=p1><A title="首 页"
href="http://o.99081.com/tianshixiaoyi/index.php">Home首页</A> < /li>
<LI class=mouseout id=p2><A title=商品搜索
href="http://o.99081.com/tianshixiaoyi/search.php?action=search">Search商品搜索</A> </li >
<LI class=mouseout id=p3><A title=订单查询
href="http://o.99081.com/tianshixiaoyi/member.php?action=order">Order订单查询</A> </li >
这样写的不知道还少了什么 哪个 class=mouseout 变化的代码
<!--
#top2 LI.self A {
BACKGROUND: url(img/nav_bg_current.gif) no-repeat left -40px; COLOR: #fff
}
-->
</style>
<BODY onload='onloadcss()'>
<SCRIPT language=javascript>
var url=location.pathname;//获得url/后的值
var arrdir=url.split("/");//分割url得到数组
dirname=arrdir[1].toString();//取数组的第二个数
function cssstyle(objName,selfname){
if(dirname=="" || dirname=="index.php"){//当前目录是首页时
if (selfname=="index.php")
document.getElementById(objName).className='self';
else
return("");
}
else//不是首页时
{
if (selfname=="")
return("");
else if(dirname==selfname)
document.getElementById(objName).className='self'
}
}
function onloadcss(){
cssstyle("p1","index.php");
cssstyle("p2","search.php");
cssstyle("p3","member.php");
cssstyle("p4","group.php")
cssstyle("p5","brand.php")
cssstyle("p6","cart.php")
cssstyle("p7","goods.php")
cssstyle("p8","page.php")
cssstyle("p9","bbs")
}
</SCRIPT>
<LI class=mouseout id=p1><A title="首 页"
href="http://o.99081.com/tianshixiaoyi/index.php">Home首页</A> < /li>
<LI class=mouseout id=p2><A title=商品搜索
href="http://o.99081.com/tianshixiaoyi/search.php?action=search">Search商品搜索</A> </li >
<LI class=mouseout id=p3><A title=订单查询
href="http://o.99081.com/tianshixiaoyi/member.php?action=order">Order订单查询</A> </li >
这样写的不知道还少了什么 哪个 class=mouseout 变化的代码