javascript事件控制

1.实现类似<a>标签的功能

<script type="text/javascript">

functionmouseover(object){

object.color="red";

}

functionmouseout(object){

object.color="blue";

}

 </script>

<font style="cursor:hand" onclick="window.location.href='http://www.baidu.com'" onmouseover="mouseover(this)" onmouseout="mouseout(this)">百度欢迎您</font>

2.按钮点击事件

<input type="button" value="test" onclick="window.alert('mytest')"/>

相关推荐