输入框禁止输入法

禁止输入法
形式:

<INPUT TYPE=text STYLE="ime-mode:disabled" >

参数说明形式:

active 代表输入法为中文
inactive 代表输入法为英文
auto 代表打开输入法 (默认)
disable 代表关闭输入法
具体例子如下:

<INPUT onfocus=" this.style.imeMode='active' " />
<INPUT onfocus=" this.style.imeMode='inactive' " />
<INPUT onfocus=" this.style.imeMode='auto' " />
<INPUT onfocus=" this.style.imeMode='disabled' " />

禁止input 粘贴
具体例子如下:

<input id=VC class="xinput" maxlength=4 size="5" onkeydown="fnKeyDown(event);" onfocus="this.select()"
     onclick="this.select()" onpaste="return false" ondrop="return false" ondragenter="return false;"
     ondragstart="return false" onkeypress="return keyDigt(event)" value=""/>

参数说明:

οndragstart="return false"   禁止鼠标在网页上拖动

ondragenter 当用户拖曳对象到一个合法拖曳目标时在目标元素上触发

οnpaste="return false" 禁止粘贴

 
其他方法

方法一:
在ie可以完全屏蔽input 输入,但firefox上面去掉了光标,还是可以输入字符

<input type="file" id="file1" contenteditable="false" />

方法二:

 用checkbox控制.....

<script language="javascript">
  function ischeck(){
     var ischeck=document.form1.iswrite.checked;
     var isshow=document.getElementById("show");
     if (ischeck==true){
          isshow.disabled="";
      }else{
          isshow.disabled="disabled";
      }
  }
</script>

HTML

<tr bgcolor="#FFFFFF">
     <td><input type="checkbox" name="iswrite"  onclick="ischeck()" id="iswrite"value="0">自定义输入</td>
</tr>
<tr bgcolor="#FFFFFF">
     <td><input name=""  id="show" type="text"  disabled="disabled" value="" size="20" />
</tr>

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值