
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/htmlcharset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
function addid(obj,idname){
obj.id=idname
}
function showidname(){
alert(document.getElementById("current").id)
}
</script>
</head>
<body>
<a href="#" onclick="addid(this,'current')">测试测试</a><br/>
<a href="#" onclick="showidname()">看看有没有加上</a>
</body>
</html>
hover就是鼠标放上去后,标签的样式,可以给a标签注册一个onmouseover和onmouseout事件,在事件处理函数中改变标签的样式。<a href="" id="aa">dsdfdsfdfsdfds</a>
<script>
document.getElementById("aa").onmouseover=function(){
document.getElementById("aa").style="color:red"
}
document.getElementById("aa").onmouseout=function(){
document.getElementById("aa").style="color:blue"
}
</script>
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)