whats wrong with this java script?

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>
 
M

Marina

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.
 
G

Guest

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top