同一页面下超连接显示问题 我现在有一个页面a其中有4个超连接,目标地址都是a,现在希望点过以后的连接显示跟其他的连接不同,当再点另一个连接后其他的样子一致,刚点过的特殊,也就是说有1,2,3,4这四个连接,点1,连接到a,此时1的显示情况跟2,3,4不同,而点2,后1,3,4显示的相同. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <script>var currentA = null; window.onload = function(){ var a = document.getElementsByTagName('a'); for ( var i = 0; i < a.length; i++ ) { a[i].onclick = function() { if (currentA != null) { currentA.parentNode.style.backgroundColor = 'white'; } currentA = this; this.parentNode.style.backgroundColor = 'blue'; }; } }; </script></head><body> <div><a href="#">xxxx</a></div> <div><a href="#">xxxx</a></div> <div><a href="#">xxxx</a></div> <div><a href="#">xxxx</a></div></body></html> 请教extjs中悬停提示的问题 Javascript如何获取GridView的数据啊??急~~~~ 求关于prototype的each方法解释 再问一个问题,请fantiny帮我看一下。谢谢了。 高分,求一段代码! JS标签代码生成 仅用js能把excel嵌入到web中么? 以下代码如何写??搞定马上高分相送!!! mini问题 js图片特效不显示 求助script 如何写才能实现我的要求?? 验证一个文本框内容
var currentA = null;
window.onload = function(){
var a = document.getElementsByTagName('a');
for ( var i = 0; i < a.length; i++ ) {
a[i].onclick = function() {
if (currentA != null)
{
currentA.parentNode.style.backgroundColor = 'white';
}
currentA = this;
this.parentNode.style.backgroundColor = 'blue';
};
}
};
</script>
</head>
<body>
<div><a href="#">xxxx</a></div>
<div><a href="#">xxxx</a></div>
<div><a href="#">xxxx</a></div>
<div><a href="#">xxxx</a></div>
</body>
</html>