Wrox Home  
Search P2P Archive for: Go

  Return to Index  

html_code_clinic thread: setting textfield focus onLoad


Message #1 by "Naima Sarfa" <wrox@p...> on Fri, 1 Feb 2002 02:46:19
Here's what we do.  We only code for IE 5.0, so I don't know if this will
work with Netscape.
We use this line:
<body onload="WindowOnLoad()">

Then we code a javascript function named WindowOnLoad like this:
function WindowOnLoad()
{
	document.frmName.btnName.focus();
	return;	
}

> -----Original Message-----
> From:	Yoganarasimha G [SMTP:yoganarasimha.g@m...]
> Sent:	Thursday, January 31, 2002 10:19 PM
> To:	HTML Code Clinic
> Subject:	[html_code_clinic] RE: setting textfield focus onLoad
> 
> u cannot use onLoad() as this is executed before the form is rendered.
> u can do it by including following script at the end of ur page..
> < script language="javascript">
> 	document.theForm.theFieldName.focus()
> < script >
> 
> 
> -----Original Message-----
> From: Naima Sarfa [mailto:wrox@p...]
> Sent: Friday, February 01, 2002 8:16 AM
> To: HTML Code Clinic
> Subject: [html_code_clinic] setting textfield focus onLoad
> 
> 
> I'm having some trouble with this...
> 
> I want a page to focus on a specific textfield when it is loaded. I
> tried 
> the following code: onLoad=document.theForm.theFieldName.focus() ,in the
> 
> documents BODY tag where theForm is the name of the form and
> theFieldName 
> is the name of the textfield, but that only brings up an error
> message...
> 
> Anyone? =)
> 
> Naima
> $subst('Email.Unsub').
> 
> $subst('Email.Unsub').

  Return to Index