Don,
I believe the problem is you have your <td> with the id and you want
the focus in the form field. You are not referencing the form field when
you use x.focus() you are referencing the id of the <td> so it doesn't
know to set focus to the form field. You would need to pass in the form
field names and set focus to them.
Does that make sense?
Ben
-----Original Message-----
From: Chunshen (Don) Li [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 02, 2004 9:57 AM
To: CF-Community
Subject: Focus, focus, where's my focus?
Hello,
With the following CSS and js code, the goal is when an item is clicked
window's focus should go to that item (blinking cursor inside the input
box), why current code does not bring up the focus while receiving no
error?
TIA
<script language="_javascript_" type="text/_javascript_">
function togglecell(obj) {
var x = document.getElementById(obj);
y = x.style.visibility;
if (y != "visible")
{
x.style.visibility ="visible";
x.focus();
// the above focus fails, why?
}
else
{
x.style.visibility="hidden";
}
}
</script>
<table>
<tr>
<th><a href="" a</a></th>
<th><a href="" b</a></th>
<th><a href="" c</a></th>
</tr>
<tr><td colspan="3" height="10"></td></tr>
<tr>
<td id="1" style="visibility: hidden">a: <input type="text"
name="a"></td>
<td id="2" style="visibility: hidden">b: <input type="text"
name="b"></td>
<td id="3" style="visibility: hidden">c: <input type="text"
name="c"></td>
...
</tr>
</table>
________________________________
[Todays Threads]
[This Message]
[Subscription]
[Fast Unsubscribe]
[User Settings]