zoukankan      html  css  js  c++  java
  • EasyUI 表单赋值

    前言

    使用easyui进行功能的开发,经常会用到表单,以下对表单赋值进行总结。

    textbox 文本框赋值

    代码如下:

    //文本框
    <input type="text" class="easyui-textbox" name="txt1" id="txt1" />
    //给文本框赋值
    $("#txt1").textbox('setValue', '我是文本框');
    

    combobox 组合框赋值

    代码如下:

    //下拉框
    <select class="easyui-combobox" data-options="editable:false,panelHeight:'auto',130" name="com1" id="com1" ></select>
    //给下拉框赋值
    $("#com1").combobox('setValue', '下拉框值1');
    

    datebox 日期框赋值

    代码如下:

    //日期框
    <input type="text" class="easyui-datebox" name="datebox1" id="datebox1"/>
    //给日期框赋值
    $("#datebox1").datebox('setValue', '时间');
    

    Datetimebox 日期时间框

    代码如下:

    //日期时间框
    <input type="text" class="easyui-datetimebox" name="datetimebox1" id="datetimebox1"/>
    //给日期文本框赋值
     $('#datetimebox1').datetimebox({
      value: '时间值',
      showSeconds: false //定义是否显示秒的信息
    });
    

    radiobutton 单选赋值

    代码如下:

    //单选
    <label for="sfbt" class="lab">是否必填:</label>
    <input type="radio" class="easyui-validatebox" name="sfbt"  value="是" /><label>是</label>
    <input type="radio" class="easyui-validatebox" name="sfbt"  value="否" /><label>否</label>
    //給单选赋值
    if (rows[0].isrequired == true) {
      $("input[name='sfbt'][value='是']").prop("checked", true);
    } else {
      $("input[name='sfbt'][value='否']").prop("checked", true);
    }
    

    numberbox 数字框赋值

    代码如下:

    //数字框
    <input type="text" class="easyui-numberbox ins" name="zs" id="zs" data-options="min:0,precision:0"/>
    //给数字框赋值
    $("#zs").numberbox('setValue', 1);
    

    min:0 --最小值
    precision:0 --需要显示的小数位

    Validatebox 验证框赋值

    代码如下:

    //验证框
    <input id="validatebox1" class="easyui-validatebox" data-options="required:true,validType:'email'">
    //验证框赋值
    $("#validatebox1").validatebox('setValue', '123456@qq.com');
    

    passwordbox 密码框赋值

    代码如下:

    //密码框
    <input id="passwordbox1" class="easyui-passwordbox" prompt="Password" iconWidth="28" />
    //密码框赋值
    $("#passwordbox1").passwordbox('setValue', '123456');
    
  • 相关阅读:
    课堂讨论电子版
    轻量级推送及在此基础上的即时通讯探索(1)
    第十章 Android的消息机制
    第十一章 Android的线程和线程池
    第八章 理解Window和WindowMannager
    第四章 View的工作原理
    第三章 View的事件体系
    第二章 IPC
    Android独立音量播放器
    SpringMVC笔记
  • 原文地址:https://www.cnblogs.com/ZengJiaLin/p/15179123.html
Copyright © 2011-2022 走看看