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中还是能看见

  • 相关阅读:
    Wiki开源软件 介绍
    实时股票获取API
    .net 下动态加载自定义控件后传值及函数调用方法
    vim(gvim)相关插件整理
    CPPUnit 测试宏
    .bash_profile和.bashrc
    Linux下SSH配合SecureCRT的密匙完美使用方法(图)
    Windows下编译gdal使其支持proj
    收藏:解析#pragma指令
    Windows 2003中打开DirectX加速
  • 原文地址:https://www.cnblogs.com/xlj227/p/6039175.html
Copyright © 2011-2022 走看看