javascript操作a标签属性

注意是style.textDecoration

而不是style.text-decoration

浏览器不识别js中的text-decoration

说明:

该代码尽在chrome,firefox环境下,测试运行正常;

在IE6.0环境下下,测试无效果;

在IE7+ 环境下,未测试;

附上代码:

<script type="text/javascript">
 <!--
 //alert("132")
 -->
 
function changeColor(num){
    document.getElementById("rowcolumn_"+num).style.color="red";
    document.getElementById("rowcolumn_"+num).style.textDecoration="underline";

}
function changeColorTwo(num){
    document.getElementById("rowcolumn_"+num).style.color="black";bulldog
    document.getElementById("rowcolumn_"+num).style.textDecoration="none";
}
</script>
</head>
<body>
<a href="#" style="text-decoration:none; color:#000000;" id="rowcolumn_1" οnmοuseοver="changeColor('1');" οnmοuseοut="changeColorTwo('1');" >11111</a> <br/>

<a href="#" style="text-decoration:none; color:#000000;" id="rowcolumn_2" οnmοusemοve="changeColor('2');"  οnmοuseοut="changeColorTwo('2');">22222222</a> <br/>

<a href="#" style="text-decoration:none; color:#000000;" id="rowcolumn_3" οnmοusemοve="changeColor('3');"  οnmοuseοut="changeColorTwo('3');">33333333</a> <br/>

</body>
</html>

注意是style.textDecoration

而不是style.text-decoration

浏览器不识别js中的text-decoration

说明:

该代码尽在chrome,firefox环境下,测试运行正常;

在IE6.0环境下下,测试无效果;

在IE7+ 环境下,未测试;

转载于:https://www.cnblogs.com/ctou45/archive/2011/05/16/2047759.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值