zoukankan      html  css  js  c++  java
  • jQuery为Input赋值

    一、窗体对话框

     1    <div id="WinData" class="easyui-dialog" style="265px;height:170px;padding:15px" closed="true" iconCls="icon-app" title="单位资料维护" 
     2      minimizable="true" maximizable="true" resizable="true"  buttons="#WinData-buttons">  
     3         <form id="fm" method="post" novalidate>  
     4             <div class="fitem">  
     5                 <label>单位编号:</label>  
     6                 <input name="dwbh" style="150px">  
     7             </div>  
     8            <div class="fitem">  
     9                 <label>单位名称:</label>  
    10                 <input name="dwmch" style="150px">  
    11             </div>  
    12            <div class="fitem">  
    13                 <label>备 注:</label>  
    14                 <input name="beizhu" style="150px">  
    15             </div>  
    16         </form>  
    17     </div>  
    18     <div id="WinData-buttons">  
    19         <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="SaveData()">保 存</a>  
    20         <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#WinData').dialog('close')">取 消</a>  
    21     </div>  

    2、设置函数

     1  function InitControl() {
     2             $.get('../Source/maxbh.ashx', { "action": "maxbh", "tbName": "dwdoc", "fldName": "dwbh" }, function (result) {
     3                 var result = eval('(' + result + ')');
     4                 if (result.success) {
     5                     var frm = $('#fm');
     6                     var name = "dwbh";
     7                     SetInputValue(frm, name, result.maxbh);
     8                     var names = "dwmch,beizhu";
     9                     SetInputEmpty(frm, names);
    10                 } else {
    11                     AlterError("系统初始化失败!");
    12                 }
    13             });
    14         }
     1 function SetInputEmpty(frm, Names) {
     2     var Arr = Names.split(",");
     3     for (var i = 0; i < Arr.length; i++) {
     4         var name = Arr[i];
     5         var txt = frm.find("input[name=\"" + name + "\"]");
     6         txt.val("");
     7     }
     8 }
     9 
    10 function SetInputValue(frm, Name, Value) {
    11     var txt = frm.find("input[name=\"" + Name + "\"]");
    12     txt.val(Value);
    13     //txt[0].value = vallue;
    14 }
  • 相关阅读:
    03_02_leetcode_11_盛最多的水
    03_01_跳跃表
    初学Java算法编程_Array List自己和官方文档的区别
    编译原理习题解析-第1章
    VS2019配置C+++mingW32配置
    自创理解绝对定位和相对定位的方法
    Solution -「洛谷 P7395」「CoE-I 2021C」弹珠游戏
    Solution Set -「ARC 113」
    Solution Set -「ABC 192」
    Solution Set -「CF 1486」
  • 原文地址:https://www.cnblogs.com/easypass/p/2762870.html
Copyright © 2011-2022 走看看