zoukankan      html  css  js  c++  java
  • js的属性事件

    第一个事件是:当点击按钮,会弹出弹框【alert();】事件!

    代码区:

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title></title>
    </head>
    <body>
    <input tupe="text" id="inp-text">
    <select id="select1">
    <option>北京</option>
    <option>上海</option>
    <option>芜湖</option>
    </select>
    <input type="button" value="按钮" id="inp-but">
    <script type="text/javascript">
    window.onload=function(){
    var input=document.getElementById('inp-text');
    var select=document.getElementById('select1');
    var button=document.getElementById('inp-but');
    button.onclick=function(){
    alert(input.value);
    alert(input.value+"在"+select.value);
    }
    }
    </script>
    </body>
    </html>

    效果图:

    第二种事件是:当点击按钮时,则选中select中的,那么输入框里的就对应于select中选中的!

    第三种事件是:当点击按钮,输入框会对应标签中的代码!

  • 相关阅读:
    servlet中如何实现通过Spring实现对象的注入
    异步Socket
    JAVA NIO实现
    【Java并发】
    JAVA实现阻塞队列
    lock与synchronized比较
    线程执行顺序
    ConcurrentHashMap 1.8
    LeetCode 416 分割等和子集
    linux常用指令
  • 原文地址:https://www.cnblogs.com/momox/p/7686339.html
Copyright © 2011-2022 走看看