You are here: Why does Opera lose the focus on a input box if I scroll with a JavaScript « HTML « IT news, forums, messages
Why does Opera lose the focus on a input box if I scroll with a JavaScript

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация