I can't prevent key presses from changing a selected option in Firefox
- by Anthony
Using Firefox 3.5.7
The following test page should behave like Opera, Safari and Chrome.
Key presses (arrows or 1-5) should have no effect (i.e. The events should be cancelled so that the number never changes from the initial default "3").
[I have separate working code for IE too].
Many thanks to anyone who can make it work?
<html>
<head>
<title>Test</title>
<script type='text/JavaScript'>
function stop(evt)
{evt.preventDefault();
evt.stopPropagation();
};
</script>
</head>
<body>
<select onkeydown='stop(event);' onkeypress='stop(event);'>
<option>1</option>
<option>2</option>
<option selected="selected">3</option>
<option>4</option>
<option>5</option>
</select>
</body>
</html>