DWR util.js 学习笔记 整理

2019-09-14 07:22:18于海丽

    <option  value="4444" select> 香蕉 </option>
    <option  value="3"> 鸭梨 </option>
       </select>
       <input type="button" id="button" value="5555"/>

      那么: DWRUtil.getValues({textarea:null,select:null,text:null,password:null,button:null})
      将返回  ^^^^^^^^^^^^^^^^{textarea:1111,select:4444,text:2222,password:3333,button:5555}

    
   /**************************************************************************************/
   /**************************************************************************************/
   /**************************************************************************************/

   7、DWRUtil.onReturn 防止当在文本框中输入后,直接按回车就提交表单。

     <input type="text" onkeypress="DWRUtil.onReturn(event, submitFunction)"/>
     <input type="button" onclick="submitFunction()"/>

   /**************************************************************************************/
   /**************************************************************************************/
   /**************************************************************************************/

   8、DWRUtil.selectRange(ele, start, end);

      在一个input box里选一个范围 

      DWRUtil.selectRange("sel-test", $("start").value, $("end").value);

      比如:<input type="text" id="sel-test" value="012345678901234567890">

      DWRUtil.selectRange("sel-test", 2, 15); 结果 文本框中的值"2345678901234"将被选中'

   /**************************************************************************************/
   /**************************************************************************************/
   /**************************************************************************************/

   9、DWRUtil.setValue(id,value);
      为指定的id元素,设置一个新值;
   /**************************************************************************************/
   10、DWRUtil.setValues({  
    name: "fzfx88", 
    password: "1234567890" 
    }