zoukankan      html  css  js  c++  java
  • JS响应事件

    <!DOCTYPE html>
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>JS响应事件练习</title>
        <meta charset="utf-8" />
    
    </head>
    <body>
        用户名: <input type="text" />
        <br />
        <br />
        <input type="button" value="确定" id="click" />
        <script>
            document.write("<br/>");
            btn = document.getElementById("click");
            btn.onclick = function () {
                alert("HelloWorld!")
            }
        </script>
        <img src="a.jpg" id="a" />
    
        <script>
            document.getElementById("a").onmouseover = function () {
                this.src = "b.jpg";
            }
            document.getElementById("a").onmouseout = function () {
                this.src = "a.jpg";
            }
        </script>
    
    
        <form id="form1" action="http://www.baidu.com">
    
            用户名:<input type="text" id="name" />
            <br />
            <br />
           <input type="submit" />
    
            <script>
                document.getElementById("form1").onsubmit = function () {
                    name = document.getElementById("name").value;
                    if (name =="") {
                        alert("请输入用户名");
                        return false;
                    }
                    return name;
                }
            </script>       
        </form>
    </body>
    </html>
  • 相关阅读:
    scott登录查询常用语句
    Oracle服务端及客户端安装
    SVN简单使用
    dos命令--查询进程
    第二周学习总结
    第一周学习总结
    虚拟机安装教程及网络连接方式的解释
    两天学习总结
    方差
    thinkphp 总结 转
  • 原文地址:https://www.cnblogs.com/zhang1997/p/8203000.html
Copyright © 2011-2022 走看看