Web design tips on form input boxes

Web design tips on form input boxes
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>

<<:  Detailed explanation of the process of Zabbix active, passive and web monitoring in distributed monitoring system

>>:  Use of MySQL SHOW STATUS statement

Recommend

uniapp implements date and time picker

This article example shares the specific code of ...

Prometheus monitors MySQL using grafana display

Table of contents Prometheus monitors MySQL throu...

Native js to implement 2048 game

2048 mini game, for your reference, the specific ...

A brief analysis of the usage of USING and HAVING in MySQL

This article uses examples to illustrate the usag...

Detailed explanation of the calculation method of flex-grow and flex-shrink in flex layout

Flex(彈性布局) in CSS can flexibly control the layout...

Form submission page refresh does not jump

1. Design source code Copy code The code is as fol...

Button is stretched on both sides in IE

When you write buttons (input, button), you will f...

About the problem of running git programs in jenkins deployed by docker

1. First, an error message is reported when assoc...

Detailed explanation of reduce fold unfold usage in JS

Table of contents fold (reduce) Using for...of Us...

Detailed explanation of several storage methods of docker containers

Table of contents Written in front Several storag...

Docker image management common operation code examples

Mirroring is also one of the core components of D...