When the mouse is focused on the Text input box, press the Enter key to refresh the page. Reasons and solutions_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:54:50
Original
1251 people have browsed it

Premise: There is only one input box in a form. When the input box gets focus, click Enter, causing the entire page to refresh. Solution to the problem.

1. Process the form


Add events to the form

.. .....


2. Add a hidden input box, think of changing a single input box


3. Block the Enter key


1> Global method to remove carriage return events

function document.onkeydown() {

var e = event.srcElement ;

if (event.keyCode == 13) {

return false;

} }

}


2> Method to remove the enter event of the input box

onkeydown="return ClearSubmit(event)"



function ClearSubmit(e) {

                                                                                                    ​>

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