当前位置:首页 >> 网络编程

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的事件有所认识了呢,有疑问就给我留言吧