Web design tips on form input boxes

Web design tips on form input boxes

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

Recommend

Tomcat configuration and how to start it in Eclipse

Table of contents How to install and configure To...

Complete steps of centos cloning linux virtual machine sharing

Preface When a Linux is fully set up, you can use...

Detailed explanation of memory management of MySQL InnoDB storage engine

Table of contents Storage Engine Memory Managemen...

The difference between ID and Name attributes of HTML elements

Today I am a little confused about <a href=&quo...

Introduction and analysis of three Binlog formats in MySQL

one. Mysql Binlog format introduction Mysql binlo...

MySQL 8.0.12 decompression version installation tutorial personal test!

Mysql8.0.12 decompression version installation me...

What you need to know about MySQL auto-increment ID

Introduction: When using MySQL to create a table,...

html option disable select select disable option example

Copy code The code is as follows: <select> ...

How to view the database installation path in MySQL

We can view the installation path of mysql throug...

Node+socket realizes simple chat room function

This article shares the specific code of node+soc...

Detailed explanation of where the image pulled by docker is stored

20200804Addendum: The article may be incorrect. Y...

Detailed installation steps for MySQL 8.0.11

This article shares the installation steps of MyS...

Douban website's method for making small changes to website content

<br />Reading is a very important part of th...