大侠帮我提供个top.js文件,实现点击菜单跳转页面链接的背景变色,谢谢。top.asp<script language="javalanguage" src="../javaScript/top.js"></script>
<div id="nav" class="nav">
<ul>
<li><a href="index.asp">Home</a></li>
<li><a href="../about/about.asp" title=
"About">About</a></li>
<li><a href="../products/products.asp"
title="Products">Products</a></li>
<li><a href="buy-online/buy-online.asp" title="Buy-Online">Buy-Online</a></li>
<li><a href=
"distribution/distribution.asp" title="Distribution">Distribution</a> </li>
<li><a href="contact/contact.asp"
title="Contact">Contact</a></li>
</ul>
</div>
index.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!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" />
<link rel="stylesheet" href="Inc/main.css" type="text/css" media="screen" />
<title>无标题文档</title>
</head>
<body>
<div id="wrapper">
<div id="container">
<div id="header">
<!--#include file="top.asp"-->
</div>
</div>
</div>
<div id="footer">
<!--#include file="footer.asp"-->
</div>
</body>
</html>
main.css
#nav { margin: 0 0 0 0; padding: 10px 70px 0 0; float: right; height: 27px; background: transparent; voice-family: "\"}\""; voice-family: inherit; padding-left: 10px;}
#nav ul { margin:0; padding:0; list-style:none; }
#nav li { display:inline; margin:0 2px 0 0; padding:0; text-transform:uppercase; line-height: 1.3em; font-size: 120%; }
#nav a, #nav strong { float:left; color:#fff; margin:0 10px 0 10px; padding:0 5px 0 5px; text-decoration:none; font-size: 10px; letter-spacing: 1px; margin-top: 4px; font-family: Arial, Verdana, sans-serif; }
#nav li.page_item { margin: 0 0 0 0; font-weight:bold;}#nav a {display: block; color:#fff; }
#nav a:hover {display: block;color:#e6ffc5; }
.current_page_item a { background:#2e6da4; -moz-border-radius: 0.5em; border-radius: 0.5em; }(这个是控制菜单背景色的)
<div id="nav" class="nav">
<ul>
<li><a href="index.asp">Home</a></li>
<li><a href="../about/about.asp" title=
"About">About</a></li>
<li><a href="../products/products.asp"
title="Products">Products</a></li>
<li><a href="buy-online/buy-online.asp" title="Buy-Online">Buy-Online</a></li>
<li><a href=
"distribution/distribution.asp" title="Distribution">Distribution</a> </li>
<li><a href="contact/contact.asp"
title="Contact">Contact</a></li>
</ul>
</div>
index.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!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" />
<link rel="stylesheet" href="Inc/main.css" type="text/css" media="screen" />
<title>无标题文档</title>
</head>
<body>
<div id="wrapper">
<div id="container">
<div id="header">
<!--#include file="top.asp"-->
</div>
</div>
</div>
<div id="footer">
<!--#include file="footer.asp"-->
</div>
</body>
</html>
main.css
#nav { margin: 0 0 0 0; padding: 10px 70px 0 0; float: right; height: 27px; background: transparent; voice-family: "\"}\""; voice-family: inherit; padding-left: 10px;}
#nav ul { margin:0; padding:0; list-style:none; }
#nav li { display:inline; margin:0 2px 0 0; padding:0; text-transform:uppercase; line-height: 1.3em; font-size: 120%; }
#nav a, #nav strong { float:left; color:#fff; margin:0 10px 0 10px; padding:0 5px 0 5px; text-decoration:none; font-size: 10px; letter-spacing: 1px; margin-top: 4px; font-family: Arial, Verdana, sans-serif; }
#nav li.page_item { margin: 0 0 0 0; font-weight:bold;}#nav a {display: block; color:#fff; }
#nav a:hover {display: block;color:#e6ffc5; }
.current_page_item a { background:#2e6da4; -moz-border-radius: 0.5em; border-radius: 0.5em; }(这个是控制菜单背景色的)
解决方案 »
- 新手,想问一个关于内存泄露的问题
- document.getElementById("div"+i).style.display = "bl在chrome中 不能用?
- js如何设置不让table中的tr 行被选中
- Javascript中如何调用外部CSS中的一个STYLE
- 怎么设定jqueryui中的dialog返回值给input(输入框点击打开dialog,dialog中有一个按钮,点击返回值给输入框,并关闭)
- 能否判断打开的窗口是否是网页对话框?
- 如何为在线编辑器添加图片。跟传统用法有别,请指教,高分送上。
- 我想问一个有关取消form表单提交的问题
- 急急急,谁能说一下xmlhttp的技术要点和一般的实现方法
- 救命!!!如何在一个窗口关闭前要提出确认,如果yes,就关闭窗口,如果no,就不关窗口
- 百度搜索页面跳转问题
- 哪位大侠知道像武林英雄这种网页游戏是用什么技术实现的?
.sel { background:#2e6da4; -moz-border-radius: 0.5em; border-radius: 0.5em; }
.nosel { background:#fff; -moz-border-radius: 0.5em; border-radius: 0.5em; }
</style>top.js如下(直接写了,你自己摘出去):
<script>
function setSel(theName,obj,noSel,Sel)
{
for(var i=0;i<$n(theName).length;i++)
{
$n(theName)[i].className=$n(theName)[i]==obj?Sel:noSel;
};
obj.className=Sel;
}function $n(nameStr)
{
return document.getElementsByName(nameStr);
}</script>菜单需要加些料(只取两个,余下你自己加):
<div id="nav" class="nav">
<ul>
<li> <a name="mn" href="index.asp" class="nosel" onclick="javascript:setSel(this.name,this,'nosel','sel'); >Home </a> </li>
<li> <a name="mn" href="../about/about.asp" title=
"About" class="nosel" onclick="javascript:setSel(this.name,this,'nosel','sel');>About </a> </li>
</ul>
</div> 生效先给分,原理自己过后慢慢想。