check if an input with specific type is selected
<p>I'm using the folowing code to check if an input field is selected but I don't no where the problems is, because it is not working!</p>

<pre><code>   &lt;html&gt;
&lt;head&gt;
&lt;title&gt;Test  &lt;/title&gt;
&lt;head&gt;
&lt;body&gt;
&lt;form &gt;
&lt;input type="text" id="select" value="select"/&gt;
&lt;/form&gt;

&lt;script type="text/javascript" &gt;
var d, len,i, j, el;
d=document.forms;
len=d.length;
for(i=0; i&lt;len; i++){
el=d[i].elements;
 for(j=0;j&lt;el.length; j++)
  if(el[j].type == "text" &amp;&amp; el[j].focus())
  {
  alert("you selected an input field with type text");
  }
}
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>Any help would be much appreciated! Thanks!</p>
