zoukankan      html  css  js  c++  java
  • js3——表格下拉

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>常见事件</title>
    </head>
    <body>
    <form action="#" id="form" onclick="checkForm();">
    <input type="text" id="username">
    <select id="city">
    <option>--请选择城市列表--</option>
    <option>广州</option>
    <option>上海</option>
    <option>西安</option>
    </select>
    <input type="submit" value="提交">
    </form>
    <script>
    /*
    1、失去焦点事件 离焦事件
    document.getElementById("username").onblur=function () {
    alert("失去焦点了");
    2、加载完成事件 onload

    } **/
    /*window.onload=function () {
    document.getElementById("username").onblur=function () {
    alert("失去焦点了");
    }
    //3、绑定鼠标移动到元素之上事件
    document.getElementById("username").onmouseover=function () {
    alert("鼠标来了");
    }
    //4、绑定鼠标点击事件 定义方法时,定义一个形象,接受event对象
    //定义方法时 定义以恶形参,接受event对象
    //event对象的button属性可以获取鼠标按钮键被点击
    //event对象的button
    //
    document.getElementById("username").onmousedown=function () {
    alert("鼠标点击了");

    }
    //4-1
    document.getElementById("username").onmousedown=function (event) {
    alert(event.button);
    }
    document.getElementById("username").onchange=function (event) {
    alert("改变了。。");
    }
    document.getElementById("city").onchange=function (event) {
    alert("改变了。。");
    }
    //表单事件 1、onsubmit 确认按钮被点击 *可以阻止表单的提交 2、onreset 重置按钮被点击
    }
    document.getElementById("form").onsubmit=function () {
    //校验用户名格式是否正确
    var flag=false;
    return flag;
    }/*/
    function checkForm() {
    return false;
    }
    </script>
    </body>
    </html>

  • 相关阅读:
    Vue响应式之依赖收集与派发更新
    异步组件(工厂函数)笔记总结
    vue源码学习
    render函数使用
    通过Vue.extned动态创建组件
    Runtime-Compiler和Runtime-Only的区别
    vue中bus的使用
    vue中全局的message
    css通用
    js通用函数封装
  • 原文地址:https://www.cnblogs.com/soyadios/p/11963437.html
Copyright © 2011-2022 走看看