Home > Web Front-end > JS Tutorial > body text

javascript Get the KeyCode code in IE and FireFox at the same time_javascript skills

WBOY
Release: 2016-05-16 18:35:18
Original
1117 people have browsed it

HTML

Copy code The code is as follows:

Javascript
Copy code The code is as follows:

function submit1(e){
var isie = (document.all) ? true : false;//Determine whether it is IE kernel or Mozilla
var key;
if (isie)
key = window.event.keyCode;//IE uses the windows.event event
else
{
key = e.which;//There is one key function out of 3 The default hidden variable is passed here using e. e.which gives an index value to the Mo kernel (note 1)
}

if(key==13)
send1('loginemail','loginpsw');//triggered Events can be customized

}

For more details, please refer to the next article.
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