javascript实现类似超链接的效果


实现类似超链接的效果,this代表本页面元素

复制代码 代码如下:

<html>
<head>
<script type="text/javascript">
function mOver(obj){
    obj.color="red";
}
function mOut(obj){
    obj.color="blue";
}
</script>
</head>
<body>
<font style="cursor:hand"
onclick="window.location.href='http://www.baidu.com/'"
onmouseover="mOver(this)"
onmouseout="mOut(this)" >欢迎进入</font>
</body>
</html>

小伙伴们是否对javascript的事件有所认识了呢,有疑问就给我留言吧


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3