|
Posted by Stefan Mueller on 11/14/05 20:51
With
document.MyForm.MyField.focus();
I set the focus to the input field just after the page has been loaded. This
works perfect.
Two seconds later the JavaScript
window.setTimeout("window.scrollTo(0, 0)", 2000);
scrolls to the top of the page.
Unfortunately in Opera the input box loses the focus after the scrolling
event. With Internet Explorer and Mozilla the focus is still on the input
box.
Is there a way (workaround) to keep the focus also with Opera on the input
box?
Stefan
====================================
<html>
<script type = 'text/javascript'>
function AfterLoad() {
document.MyForm.MyField.focus();
window.setTimeout("window.scrollTo(0, 0)", 2000);
}
</script>
<body onLoad = "AfterLoad()">
<form name="MyForm">
Top Row
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<input type = "input" name = "MyField" value = "">
</form>
</body>
</html>
Navigation:
[Reply to this message]
|