Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

checkbox focus = no lasso?

Status
Not open for further replies.

www2004

Programmer
Aug 11, 2004
15
0
0
US
see sample code below. onload of body, i set focus to first checkbox. when page renders, checkbox does have focus (i can check the box with spacebar) but there is no lasso indicating the control has focus. if i tab to second checkbox, i see a lasso around it. if i now refresh the page or reload the page in the same browser window/tab, then i see the first checkbox with a lasso...but only after i've used the tab key in the document. why? is there any way to get this lasso to appear on initial page load?

<html>
<body onload="javascript:document.getElementById('1One').focus();">
<input type=checkbox name="1One" id="1One">One
<input type=checkbox name="2Two" id="2Two">Two
</body>
</html>
 
Sure. Adding form tags does not help. I see this behavior in ie6 and ie7. Have tested no other browsers as of yet. This is a small example of the same behavior I see in an asp.net application.

<html>
<body onload="javascript:document.getElementById('1One').focus();">
<form name="form1">
<input type=checkbox name="1One" id="1One" tabindex=1>One
<input type=checkbox name="2Two" id="2Two" tabindex=2>Two
</form>
</body>
</html>
 
Running that exact code in IE 6, IE 7, Opera 9.26, Safari 3 (Win), and Fx 2, it works in all cases except Opera. I'm running on Win XP SP2.

So Opera is the only browser I do not see the focus rectangle in.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Interesting - as a hunch (mine are usually right ;-)), I went into "Control Panel" -> "Display" -> "Appearance" -> "Effects" and checked the "Hide underlined letters" box. What do you know? I see what you're seeing.

The default "out of the box" setting is to have this checked... it's always one of the first settings I change when installing XP (along with the crappy taskbar and explorer-for-dummies settings). So it seems like this also affects the focus rectangle. You might have to restart IE after changing this setting.

Hope this helps,
Dan.



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Your hunch was definitely right this time. Very interesting. Thank you for taking the time to think this one through...I very much appreciate it!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top