aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Why select() and focus() not work every time? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Why select() and focus() not work every time?" Watch "Why select() and focus() not work every time?" New topic
Author

Why select() and focus() not work every time?

Ryan Chiu
Greenhorn

Joined: Jun 21, 2005
Posts: 5
dear all:

I try to set focus and selected on a text box, so I write like this

<html:html>
<html:text property="AMOUNT") value="100000.00" />
....
<script>
document.getElementById("AMOUNT").focus();
document.getElementById("AMOUNT").select();
</scirpt>
</body>
</html:html>

This would work fine in the first time page load, but when next time page
load(user go to main page and go back), the script seen been ignored. So the text field wasn't selected and focused.Can anyone tell me what's wrong?

P.S. It's running fine every time when I press F5 to refresh page.

Thanks your help.

Ryan
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You may want to do


Eric
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Why select() and focus() not work every time?