This article lists some tips and codes about form input boxes in web design. 1. Dashed box when cancel button is pressed <br /> Add attribute value hideFocus or HideFocus=true in input 2. Read-only text box content Add the attribute value readonly to the input 3. Prevent the TEXT document from being cleared after going back (the style content can be used as a class reference) <INPUTstyle=behavior:url(#default#savehistory);type=textid=oPersistInput> 4. The ENTER key moves the cursor to the next input box <inputonkeydown="if(event.keyCode==13)event.keyCode=9"> 5. Only Chinese (flashing) <inputonkeyup="value=value.replace(/[-~]/g,'')"onkeydown="if(event.keyCode==13)event.keyCode=9"> 6. Only numbers (flashing) <inputonkeyup="value=value.replace(/[^/d]/g,'')"onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^/d]/g,''))"> 7. Only numbers (no flashing) <inputstyle="ime-mode: disabled"onkeydown="if(event.keyCode==13)event.keyCode=9"onKeyPress="if((event.keyCode<48||event.keyCode>57))event.returnValue=false"> 8. Only English and numbers can be entered (with flashing) <inputonkeyup="value=value.replace(/[/W]/g,'')"onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^/d]/g,''))"> 9. Block input method <inputtype="text"name="url"style="ime-mode:disabled"onkeydown="if(event.keyCode==13)event.keyCode=9"> 10. Only numbers, decimal points, and minus signs (-) can be entered (no flashing) <inputonKeyPress="if(event.keyCode!=46&&event.keyCode!=45&&(event.keyCode<48||event.keyCode>57))event.returnValue=false"> 11. Only two decimal places or three decimal places can be entered (flashing) <inputmaxlength=9onkeyup="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_kfxename=text_kfxe> |
<<: CSS to achieve scrolling image bar example code
>>: MySQL method of generating random numbers, strings, dates, verification codes and UUIDs
Table of contents How to install and configure To...
Preface When a Linux is fully set up, you can use...
During the front-end development process, a situat...
When building a website, HTML language may seem un...
Table of contents Storage Engine Memory Managemen...
Today I am a little confused about <a href=&quo...
one. Mysql Binlog format introduction Mysql binlo...
Mysql8.0.12 decompression version installation me...
Introduction: When using MySQL to create a table,...
Copy code The code is as follows: <select> ...
We can view the installation path of mysql throug...
This article shares the specific code of node+soc...
20200804Addendum: The article may be incorrect. Y...
This article shares the installation steps of MyS...
<br />Reading is a very important part of th...