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" onmouseover="changeColor('1');" onmouseout="changeColorTwo('1');" >11111</a> <br/>

<a href="#" style="text-decoration:none; color:#000000;" id="rowcolumn_2" onmousemove="changeColor('2');"  onmouseout="changeColorTwo('2');">22222222</a> <br/>

<a href="#" style="text-decoration:none; color:#000000;" id="rowcolumn_3" onmousemove="changeColor('3');"  onmouseout="changeColorTwo('3');">33333333</a> <br/>

</body>
</html>

注意是style.textDecoration

而不是style.text-decoration

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

说明:

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

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

在IE7+ 环境下,未测试;

posted @ 2011-05-16 15:50  ctou45  阅读(551)  评论(0编辑  收藏  举报