html input input limit_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:48:50
Original
1408 people have browsed it

 1.取消按钮按下时的虚线框在input里添加属性值 hideFocus 或者 HideFocus=true2.只读文本框内容在input里添加属性值 readonly3.防止退后清空的TEXT文档(可把style内容做做为类引用)<INPUT style=behavior:url(#default#savehistory); type=text id=oPersistInput>4.ENTER键可以让光标移到下一个输入框<input onkeydown="if(event.keyCode==13)event.keyCode=9" >5.只能为中文(有闪动)<input onkeyup="value=value.replace(/[ -~]/g,'')" onkeydown="if(event.keyCode==13)event.keyCode=9">6.只能为数字(有闪动)<input onkeyup="value=value.replace(/[^\d]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"> 7.只能为数字(无闪动)<input style="ime-mode:disabled" onkeydown="if(event.keyCode==13)event.keyCode=9" onKeyPress="if ((event.keyCode<48 || event.keyCode>57)) event.returnValue=false">8.只能输入英文和数字(有闪动)<input onkeyup="value=value.replace(/[\W]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"> 9.屏蔽输入法<input type="text" name="url" style="ime-mode:disabled" onkeydown="if(event.keyCode==13)event.keyCode=9">10. 只能输入 数字,小数点,减号(-) 字符(无闪动)<input onKeyPress="if (event.keyCode!=46 && event.keyCode!=45 && (event.keyCode<48 || event.keyCode>57)) event.returnValue=false">11. 只能输入两位小数,三位小数(有闪动)<input maxlength=9 onkeyup="if(value.match(/^\d{3}$/))value=value.replace(value,parseInt(value/10)) ;value=value.replace(/\.\d*\./g,'.')" onKeyPress="if((event.keyCode<48 || event.keyCode>57) && event.keyCode!=46 && event.keyCode!=45 || value.match(/^\d{3}$/) || /\.\d{3}$/.test(value)) {event.returnValue=false}" id=text_kfxe name=text_kfxe> 12.限制文本框输入字数<html><head><meta http-equiv="content-Type" content="text/html;charset=gb2312"><title> 限制文本框输入字数</title></head><body><script language="JavaScript">function www_zzjs_net(field, countfield, maxlimit) {if (field.value.length > maxlimit)field.value = field.value.substring(0,maxlimit);elsecountfield.value = maxlimit - field.value.length;}</script><form name="form" action="" method="post"><textarea class="editbox2" onkeydown="www_zzjs_net(this.form.memo,this.form.remLen,10)" onkeyup="www_zzjs_net(this.form.memo,this.form.remLen,10)" name="memo" cols="45" rows="8" wrap="on"></textarea><br>共可输入10字,还剩<input class="editbox1" readOnly maxLength="3" size="3" value="10" name="remLen">字。<br><input class="bottom" type="submit" value=" 提交 " name="submit"><input class="bottom" type="reset" value=" 重置 " name="reset"></form></body></html>
Copy after login

 

 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template