zoukankan      html  css  js  c++  java
  • 表单

    提交(与数据库交互)

    1、onsubmit事件触发,input、button的type为submit或者input的type为image,与服务器交互前发生,监听函数中可做验证等。preventDefault()可以阻止表单提交

    2、from.submit(),不需表单中包含提交按钮,执行后马上与服务器交互

    重置(恢复默认值)

    1、onreset事件,input、button的type为reset,preventDefault()可阻止

    表单元素

    1、from.elements,attr、index访问列表

    2、除<fieldset>外,表单元素共有的属性,disabled、form、name、readonly、type、value、tabIndex

    3、共有的事件,blur、change、focus,鼠标、键盘、HTML等事件

    input和textarea

    1、textbox.select(),选中文本框中所以的文本

    2、select事件,选择文本时触发,selectionStart、selectionEnd所选择文本的起始位置和结束位置

    3、JS选择文本,textbox.setSelectionRange(start,end),

    兼容

    function selectText(textbox, startIndex, stopIndex){
      if (textbox.setSelectionRange){
      textbox.setSelectionRange(startIndex, stopIndex);
    } else if (textbox.createTextRange){
      var range = textbox.createTextRange();
      range.collapse(true);
      range.moveStart("character", startIndex);
      range.moveEnd("character", stopIndex - startIndex);
      range.select();
    }
      textbox.focus();
    }

    4、H5验证API,required。<input>、<textarea>、<select>

    其他

    1、input的size属性是指定最多能显示字符数量,maxlength指定最多能输入的字符数

  • 相关阅读:
    Servlet-获取页面的元素的值的方式以及区别
    Http请求-get和post的区别
    Servlet-xml配置简介以及url-pattern简介
    javaweb目录结构简介
    Servlet-生命周期简介
    tomcat-四种运行模式和三种部署模式(优化)
    命名空间System.IO
    Dictionary 字典
    导出-以虚拟表的形式获取数据源
    导入excel-uploadify+npoi
  • 原文地址:https://www.cnblogs.com/dddbj/p/5785127.html
Copyright © 2011-2022 走看看