Forum Home
Press F1
 
Thread ID: 21150 2002-06-18 21:27:00 JavaScript enter Guest (0) Press F1
Post ID Timestamp Content User
55084 2002-06-18 21:27:00 Hi

a quick question

in so many website that you visit, when you press the enter it will be the same as clicking on the submit button or go button.

What I would like to know is what is the code that you can use that will do this using JavaScript?

Thanks

Please note

The JavaScripts have more than one text input area.

:)
Guest (0)
55085 2002-06-19 09:47:00 have a look at this, not sure if it suits you.

<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 3.2//EN'>
<html>
<head><title>test javascript</title>
<script type='text/javascript'>
function getKey(keyCode) {
if(window.event && window.event.keyCode == 113)
{
document.write('it works');
/*
window.location
= 'regapps.ccit.arizona.edu
*/
}
document.write('finished <br />');
document.write(window.event.keyCode);
}

</script>
</head>
<body>

<script type='text/javascript'>

document.write('start');
document.onkeypress = getKey;

</script>
</body>
</html>
Guest (0)
1