将光标隐藏在文本框中

时间:2013-05-09 11:27:16

标签: javascript

我使用z-index将两个文本框放在网页的相同位置。

加载页面时,光标将对焦于已禁用文本框下的已启用文本框。

Firefox仅显示已禁用的文本框,但不显示光标。

我的问题是IE在启用的文本框中显示禁用的文本框和光标。

我想在我的网页中仅显示已禁用的文本框。 有没有办法在IE中隐藏光标?

是样本编码......

<script>

   function FocusOnInput(){
       document.getElementById("hidden").focus();
    }

    function show(field){
        var value = field.value;
        alert(value);
    }

</script>

<body onload="FocusOnInput()">
    <div>
      <input type="text" id="securityNo"
         name="txtsecurityNo" value=""
         size="30" style="position: absolute;z-index: 0" 
                 disabled="disabled"/>

      <input type="text" id="hidden"
         name="txthidden" value=""                      
         onchange="show(this);" style="left: 0px;z-index: -1;"/>        
     </div>
</body>

0 个答案:

没有答案
相关问题