View Full Version : keyboard shortcuts
chrismiceli
09-30-2002, 11:46 PM
how can i make a text input type and when you hit enter it will click a button, like at excite or any other big sight where you go to enter your password you hit enter and it clicks the log on botton or something like that.
joh6nn
09-30-2002, 11:58 PM
that's built-in functionality. you don't have to make it, it's already there.
chrismiceli
10-01-2002, 12:11 AM
when I did the input type=submit instead of botton and the onSubmit="function1()" it works but does not do the same thing as if i made the onClick and input type=button it only does part of the function when it is a submit, could I make the enter button work with an input type=button?
glenngv
10-01-2002, 08:37 AM
<html>
<head>
<script>
function check(frm){
if (frm.username.value==""){
alert("Please enter username.");
frm.username.focus();
return false;
}
if (frm.passw.value==""){
alert("Please enter password.");
frm.passw.focus();
return false;
}
frm.submit();
}
function checkEnter(e){
var code = (document.all)?event.keyCode:e.which;
if (code==13){
check(document.f);
}
}
</script>
</head>
<body>
<form name=f action="" method=post>
Username: <input type="text" name="username"><br>
Password: <input type="password" name="passw" onkeydown="checkEnter(event)"><br>
<input type="button" name="btnSubmit" value="Login" onclick="check(this.form)">
</form>
</body>
</html>
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.