JavaScript HTML DOM 事件 onchange onmouseover onmouseout

来源:互联网 发布:手机音频编辑软件中文 编辑:程序博客网 时间:2024/05/17 00:51

onchange 事件会在域的内容改变是发生

支持该事件的标签

<input type = "text">,<select>,<textarea>

<html><head><script>    function upperCase(x)    {        var y = document.getElementById(x).value;        document.getElementById(x).value = y.toUpperCase();    }</script></head><body>输入您的姓名:<input type = "text" id = "fname" onchange = "upperCase(this.id)"/></body></html>
 onmouseover  当鼠标移到事件上时, 内容发生变化

onmouseout  当鼠标移到事件外时,内容发生变化

<html>    <body>    <div onmouseover = "mOver(this)" onmouseout = "mOut(this)" style = "background-color:green;    width:120px; height:20px; padding:40px; color:#ffffff;">把鼠标    </div>    <script>        function mOver(obj)        {            obj.innerHTML = "谢谢";        }        function mOut(obj)        {            obj.innerHTML = "把鼠标移到上面";        }    </script>    </body></html>




0 0
原创粉丝点击