zoukankan      html  css  js  c++  java
  • select 和 input 的不可编辑,input隐藏

    select 没有readOnly属性

    在jsp中

    <select  id="a" name="a" disabled="disabled">             disabled确实能使该选择框不能编辑 但是同时也将使其中的值不能提交

      <option>A</option>

      <option>B</option>

      <option>C</option>

    </select>

    如果你正好用的是google,而且又想提交表单,建议再定义一个<input>存放select的数值,隐藏起来(hidden="true")。那么提交就提交成功该数值了(name要和select的一样的哦~)

    <span onmousemove="this.setCapture();" onmouseout="this.releaseCapture();" onfocus="this.blur();">

      <select  id="a" name="a">                                   span中的意思是当获焦时 失焦,这样就不能选了,但是google不支持

        <option>A</option>                                      并且jeecg中的<t:dictSelect>也能这样不可选

        <option>B</option>

        <option>C</option>

      </select>

    </span>

    在js中

    $("#a").attr('disabled',true);

    input

    在jsp中

    <input id="b" name="b" disabled="disabled"/>                    disabled确实能使该文本框不能编辑 但是同时也将使其中的值不能提交

    <input id="b" name="b" readOnly="readOnly"/>                  readOnly能使该文本框不能编辑 而且可以提交其中的值,但是ie8不支持

    在js中

    $("#b").attr('disabled',true);

    $("#a").attr('readOnly',true);

    如果你的客户又要用ie8又要用google,我也不知道怎么办了。知道的同学麻烦告诉我一下哦~灰常感谢- -

    input隐藏

    type="hidden"  

    hindden="hidden"  ie8中还是能看见

  • 相关阅读:
    无法直接启动带有类库输出类型的项目
    2个页面传值方法
    vs2005 无法附加 绑定句柄无效 解决办法
    认识serializable,序列化
    jsp 连接sql 2008
    有进步,嘎嘎....
    找不到存储过程'dbo.aspnet_CheckSchemaVersion'
    BackOffice Common中实现的相关功能
    MVC中Action相关方法的建议
    mysql的数据库相关维护操作:重启、修改连接数、删除连接
  • 原文地址:https://www.cnblogs.com/xlj227/p/6039175.html
Copyright © 2011-2022 走看看