如何用JS控制当前正在浏览的页面的链接样式~~在线等 在链接的onclick事件里写了this.className='on'我的意思是假如我点击了‘mainA’这个链接后。其他两个的className='' 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <style type="text/css">a.on:link,a.on:visited{margin-top:2px;line-height:20px;color:#7F6D46;font-size:14px;text-decoration:none;font-size:14px;}.aa{}</style><a class="on" href="#" onclick="this.className='aa'">aaa</a> <style type="text/css">a.on:link,a.on:visited{margin-top:2px;line-height:20px;color:#7F6D46;font-size:14px;text-decoration:none;font-size:14px;}</style><a href="#" onclick="this.className='on'">aaa</a><a href="#" >vvvvvvv</a><a href="#" >vccccccc</a> my_web不太清楚你要表达的意思。 看看吧<!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><style>a{color:#f60;}a.on:link,a.on:visited{margin-top:2px;line-height:20px;color:#7F6D46;font-size:14px;text-decoration:none;font-size:14px} </style><script>function $(objID){ return "string" == typeof(objID) ? document.getElementById(objID) : objID; }function addEvt(){ var ctab = $("menu_list").getElementsByTagName("a"); for(var i = 0;i<ctab.length;i++) { ctab[i].onclick =function std(){ for(var i = 0;i<ctab.length;i++){ if(i!=parseInt(this.rel-1)) { ctab[i].className=""; } } ctab[parseInt(this.rel)-1].className="on"; } }}window.onload=addEvt;</script></head><body><div id="menu_list"><a href= '# ' id= 'mainA ' rel="1" class="on"> 主页 </a> <a href= '# ' id= 'articleA ' rel="2"> 文章 </a> <a href= '# ' id= 'albumA ' rel="3"> 相册 </a></div></body></html>你可以参考 http://www.ok22.org/art_detail.aspx?id=64 更多TAB切换效果 <!doctype html public "-//w3c//dtd html 4.0 transitional//en"><html> <head> <title> new document </title> <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> <meta name="generator" content="editplus"> <meta name="author" content=""> <meta name="keywords" content=""> <meta name="description" content=""> <style type="text/css">a.on:link,a.on:visited{margin-top:2px;line-height:20px;color:#7F6D46;font-size:14px;text-decoration:none;font-size:14px} </style> <script type="text/javascript"> function change(obj){ document.getElementById("mainA").className=""; document.getElementById("articleA").className=""; document.getElementById("albumA").className=""; obj.className="on"; } </script> </head> <body><a href= '#' id= 'mainA' onclick="change(this)"> 主页 </a> <a href= '#' id= 'articleA' onclick="change(this)"> 文章 </a> <a href= '#' id= 'albumA' onclick="change(this)"> 相册 </a> </body></html> 把input作为对象参数传入js方法,在js方法中得到怎么得到input自定义属性的值 非常着急,如何在iframe里面打印预览iframe里面的内容 xx"x\"x"xx如何用正则匹配到"x\"x" 求包含一个自定义属性的input正则 如何获得属性名? 紧急!在js中如何调用ActiveX Dll 表情由小图显示出大图效果,但显示的位置不对,有代码,请教 请高手帮忙(急)!!! 特殊要求 判断输入数字在0-99之间的js语句。请高手指点!给分 如何在网页里打开PDF的时候屏蔽工具条? window.location
a.on:link,a.on:visited{margin-top:2px;line-height:20px;color:#7F6D46;font-size:14px;text-decoration:none;font-size:14px;}
.aa{}
</style>
<a class="on" href="#" onclick="this.className='aa'">aaa</a>
a.on:link,a.on:visited{margin-top:2px;line-height:20px;color:#7F6D46;font-size:14px;text-decoration:none;font-size:14px;}
</style>
<a href="#" onclick="this.className='on'">aaa</a>
<a href="#" >vvvvvvv</a>
<a href="#" >vccccccc</a>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style>
a{color:#f60;}
a.on:link,a.on:visited{margin-top:2px;line-height:20px;color:#7F6D46;font-size:14px;text-decoration:none;font-size:14px} </style>
<script>
function $(objID){
return "string" == typeof(objID) ? document.getElementById(objID) : objID;
}
function addEvt(){
var ctab = $("menu_list").getElementsByTagName("a");
for(var i = 0;i<ctab.length;i++)
{
ctab[i].onclick =function std(){
for(var i = 0;i<ctab.length;i++){
if(i!=parseInt(this.rel-1))
{
ctab[i].className="";
}
}
ctab[parseInt(this.rel)-1].className="on";
}
}
}
window.onload=addEvt;
</script>
</head><body>
<div id="menu_list"><a href= '# ' id= 'mainA ' rel="1" class="on"> 主页 </a> <a href= '# ' id= 'articleA ' rel="2"> 文章 </a> <a href= '# ' id= 'albumA ' rel="3"> 相册 </a></div></body>
</html>你可以参考 http://www.ok22.org/art_detail.aspx?id=64
更多TAB切换效果
<html>
<head>
<title> new document </title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
<meta name="generator" content="editplus">
<meta name="author" content="">
<meta name="keywords" content="">
<meta name="description" content="">
<style type="text/css">
a.on:link,a.on:visited{margin-top:2px;line-height:20px;color:#7F6D46;font-size:14px;text-decoration:none;font-size:14px}
</style>
<script type="text/javascript">
function change(obj){
document.getElementById("mainA").className="";
document.getElementById("articleA").className="";
document.getElementById("albumA").className="";
obj.className="on";
}
</script>
</head> <body>
<a href= '#' id= 'mainA' onclick="change(this)"> 主页 </a>
<a href= '#' id= 'articleA' onclick="change(this)"> 文章 </a>
<a href= '#' id= 'albumA' onclick="change(this)"> 相册 </a>
</body>
</html>