JS网页触发事件

来源:互联网 发布:拳皇2002um出招优化 编辑:程序博客网 时间:2024/04/28 13:54
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>表单验证</title>
<script>
    function show(){
        alert('当焦点从这个文本框上移开时出来');   
    }
</script>
</head>


<body onload="alert('页面一加载就出来了');">
    <form action="" method="post">
        <!--<input type="text" onblur="show();" /><br />当焦点从这个文本框上移开时出来-->
        <!--<input type="text" onclick="alert('点击的时候触发');" />点击的时候触发-->
        <!--<input type="text" onchange="alert('内容改变,然后失去焦点的时候触发');" />-->
        <!--<input type="text" onfocus="alert('得到焦点时触发');" />-->


        <!--<input type="text" onkeypress="alert('能写出来的字符ASCII码:'+event.keyCode);" />-->
        <!--<input type="text" onkeyup="alert('键盘上的字符ASCII码:'+event.keyCode);" />-->
        <!--<input type="text" onkeydown="alert('键盘上字符的ASCII码:'+event.keyCode);" />-->


        <input type="text" onmousemove="alert('鼠标就在上面');" />
        <input type="text" onmousedown="alert('鼠标按下去了');" />
        <input type="text" onmousemove="alert('鼠标正在移动');" />
        <input type="text" onmouseout="alert('鼠标移出去了');" />
           <input type="text" onmouseup="alert('鼠标按下去后弹起来了');" />
    </form>
</body>
</html>
0 0