Dear all

I have been tasked with producing a javascript function that places focus on the first text field on any page if a text field exists on that page. The following function works quite well, except when the first text field on the page is nested within another element whose display property is set to 'none'. Although the text field is not displayed, its display property is not reported as 'none', so an exception is thrown. Is there any way to report the availability of an existing form element to receive focus?

function formFocus()
{
	var oFrms = document.forms;
	for(var i = 0; i < oFrms.length; i++)
	{
		var oFrm = oFrms[i];
		var oElmnts = oFrm.elements;
		for(var j = 0; j < oElmnts.length; j++)
		{
			var oElmnt = oElmnts[j];
			oElmnt.focus();
			return;
		}
	}
}

Many thanks!

Regards

Chris marsh
