zoukankan      html  css  js  c++  java
  • 封装Js库从获取控件的value值开始

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script type="text/javascript" >
            function show() {
                var _value = document.getElementById("text_1").value;
                alert(_value);
            }
    
            function show2() {
                alert(getValue("text_1"));
            }
            function getValue(id) {
                var _value = document.getElementById(id).value;
                return _value;
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        <input id="btn_1"  type="button" onclick="show()" value="点击我获取Value值" />
        
        <input  id="text_1" type="text" value="测试数据"/>
        <input id="btn_2" type="button"  onclick="show2()" value="封装方法" />
        </div>
        </form>
    </body>
    </html>

    show()和show2()方法的效果是一样的。

  • 相关阅读:
    springboot-配置文件
    system--属性
    url--web路径
    jquery--遍历
    javascript---知识点2
    iframe
    linux--磁盘挂载
    jquery--插件
    javascript窗口宽高
    vue--知识点
  • 原文地址:https://www.cnblogs.com/ITyueguangyang/p/4315078.html
Copyright © 2011-2022 走看看