whats wrong with this java script?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi I have some code and java script, when the page initially loads I want it
to have focus on dr_tx_names. This works. The page loads a second time with
a dropdown selection and in the code behind I have
Me.dr_lst_systype.Attributes.Add("onFocus", "javascript:DoHighlight()")
as I want the focus to go to dropdown box dr_lst_systype when the page
reloads after a selection is made from dr_lst_systype. Anyhow it seems
everytime the page reloads the dr_tx_names receives focus.

<form id="Form1" method="post" runat="server">
<script language="javascript" event="onload" for="window">
Form1.dr_tx_names.focus();
</script>
<script language="javascript">
function DoHighlight()
{document.Form1.dr_lst_system.select();}</script>
 
The dropdown doesn't have focus when the page reloads. Your onload for the
window runs, and puts focus in the textbox. So the onFocus for the dropdown
can't run, because the dropdown is not the one with the focus.
 
Hi thanks for the response. I formatted out the onload event javascript but
it still does not go to the dropdown.

<script language="javascript" event="onload" for="window">
//Form1.dr_tx_names.focus();</script>
<script language="javascript">
function DoHighlight()
{
document.Form1.dr_lst_system.select();
}
</script>--
Paul G
Software engineer.


Marina said:
The dropdown doesn't have focus when the page reloads. Your onload for the
window runs, and puts focus in the textbox. So the onFocus for the dropdown
can't run, because the dropdown is not the one with the focus.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top