Ben, Ben, thank you, where's my head?

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

Reply via email to