• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Ryan Chiu
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may want to do


Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic