Hi all,
I have some code that sets focus to a form element if it is not hidden as
follows:

<SCRIPT LANGUAGE="JavaScript">
        window.focus();
        if(document.forms[0] != null)   
                {
                if(document.forms[0].elements[0] != null) 
                        {
                        if(document.forms[0].elements[0].type != 'hidden') 
                                document.forms[0].elements[0].focus();
                        }
                }
</SCRIPT>

I wish to extend it to also exclude select boxes, but both IE and NS return
the type of the select as "select-one", but the following line:
if(document.forms[0].elements[0].type != "select-one") does not work. Focus
still gets set to the select.

Any help appreciated.

James




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to