zoukankan      html  css  js  c++  java
  • 把一些表单属性封装一个JSON

    <!doctype html>
    <html>
    <head>
        <meta charset="UTF-8">
        <title>把一些表单属性封装一个JSON</title>
        <meta name="viewport"
              content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
        <style>
    
        </style>
    </head>
    <body>
    <h1>员工查询</h1>
    
    <label>请输入员工编号:</label>
    <input type="text" id="keyword" value="dd"/>
    <button id="search">查询</button>
    <p id="searchResult"></p>
    
    <h1>员工新建</h1>
    <label>请输入员工姓名:</label>
    <input type="text" id="staffName"/><br>
    <label>请输入员工编号:</label>
    <input type="text" id="staffNumber"/><br>
    <label>请选择员工性别:</label>
    <select id="staffSex">
        <option></option>
        <option></option>
    </select><br>
    <label>请输入员工职位:</label>
    <input type="text" id="staffJob"/><br>
    <input type="hidden" id="oDiv">
    <button id="save">保存</button>
    <p id="createResult"></p>
    
    
    <script type="text/javascript">
        function d(id) {
            return document.getElementById(id);
        }
        var fdata = {};
        fdata.oname = d("staffName").value;
        fdata.onumber = d("staffNumber").value;
        fdata.osex = d("staffSex").value;
        fdata.ojob = d("staffJob").value;
        var jsonArr = JSON.stringify(fdata);
        d("oDiv").setAttribute("name", jsonArr);
    </script>
    
    
    </body>
    </html>
  • 相关阅读:
    iOS UI控件7(UITableView)
    iOS UI控件6
    iOS UI控件5-UIPickerView
    iOS UI控件4
    iOS UI控件(3)
    iOS UI控件(2) UITextView
    iOS UI控件(1)
    C# 解决上位机串口接收数据丢失问题
    C# 串口操作系列(3) -- 协议篇,二进制协议数据解析
    如何将Debug文件夹下的资源打包成一个EXE文件直接执行
  • 原文地址:https://www.cnblogs.com/yjhua/p/4939917.html
Copyright © 2011-2022 走看看