Randy Webb a écrit :
It is easy to prove me wrong though. Post a script that will determine
if an arbitrary form element can be focused or not.
<input type="text" onfocus="this.blur()" name="inputYouCantFocus">
There is too many way allowing us to hide and/or prevent the focus on an
element, let me add a few to the list.
1) the obvious <input type="hidden">
2) <input disabled="disabled">
3) <input style="opacity:0">
4) <input style="position:absolute;clip:rect(0,0,0,0)">
5)
<div style="overflow:hidden;width:0;height:0">
<input>
</div>
6)
<div style="position:absolute;z-index:1;width:300px;height:100px">
<input style="width:100px">
</div>
<div style="position:absolute;z-index:2;width:300px;height:100px;
background-color:red"></div>
7) with this one, the focus can occur only with a mouse. You got a
keyboard only, you are screwed and can't focus it at all. How a script
would be able to determine if the second input is focusable ?
<input>
<input tabindex="-1">
and many many more tricky ways to hide anything we want.
Happy scripting!
:D
--
laurent