Forum Moderators: open

Message Too Old, No Replies

how do i get focus on <input> when window is set to onBlur="self.focus

         

webslinger

3:49 pm on Jan 31, 2002 (gmt 0)

10+ Year Member



Can anyone tell me how to get focus back on input text fields when the window is set to onBlur="self.focus()".

Situation: I have a popup that has to stay on the on top of the parent window at all times until the user closes it. So basicly i have it focused the whole time using onBlur="self.focus()" in the body tag.

Problem: Now that it works, the pop has a form that doesn't allow me to input anthing in the text field because it losses focus. :( It works on NE but not in IE.

All ready tried these: i have tried putting onfocus on the input tag all the way to the form tag. i have tried writing the whole path to just using window.focus and nothing seems to solve the problem.

Code:
<body bgcolor="#5F89B3" text="#FFFFFF" onBlur="self.focus()">

<form name="form1" METHOD=POST ACTION="LookUp.asp">

<table width="53%" border="0" cellpadding="8">
<!--<tr>
<td><font face="Verdana, Arial, Helvetica, sans-serif" size="2">View layers</font></td>
<td>
<input type="radio" name="Choice" value="layers">
</td>
</tr>-->
<tr>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Last Name:</font></td>
<td>
<div align="center">
<input type=TEXT name="LName">
</div>
</td>
</tr>
<tr>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">First Name:</font></td>
<td>
<div align="center">
<input type=TEXT name="FName">
</div>
</td>
</tr>
<tr>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Rural Municipality:</font></td>
<td>
<div align="center">
<input type=TEXT name="RM">
</div>
</td>
</tr>
<tr>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Tax Roll
Number:</font></td>
<td>
<div align="center">
<input type=TEXT name="TaxRoll">
</div>
</td>
</tr>
<tr>
<td>
<div align="center"> </div>
</td>
<td>
<div align="center">
<input type=SUBMIT value="Search" name="SUBMIT">
</div>
</td>
</tr>
</table>
</form>

wardbekker

4:06 pm on Jan 31, 2002 (gmt 0)

10+ Year Member



you can write something like this...

- in header -
function getTheFocus()
{
if (window.event.srcElement != document.getElementById('foo')) {
windows.focus()
}
}

<body onBlur="getTheFocus()">
<form>
<input type='text' id='foo' ...>
</form>
</body>

webslinger

7:01 pm on Jan 31, 2002 (gmt 0)

10+ Year Member



Thanks, for the help. It pointed me to the right direction. But, it still doesn't work for me. I can't even pass back the id with an alert. Any ideas

wardbekker

7:31 pm on Jan 31, 2002 (gmt 0)

10+ Year Member



What error(s) do you get?