Home  >  Article  >  Web Front-end  >  javascript Get the KeyCode code in IE and FireFox at the same time_javascript skills

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

WBOY
WBOYOriginal
2016-05-16 18:35:181119browse

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.
Statement:
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