How to Set Focus to a Form Field 
Author Message
 How to Set Focus to a Form Field

Does anyone know how to set focus to a field in an HTML form? I know you can
use the SetFocus method if you use the Microsoft Forms 2.0 ActiveX control
on a page. But I'm looking for the equivalent code to use with just HTML
forms?

Thanks,
Hossein Mafinejad



Fri, 20 Oct 2000 03:00:00 GMT  
 How to Set Focus to a Form Field

myfield.focus()  in JScript.....

Quote:

>Does anyone know how to set focus to a field in an HTML form? I know you
can
>use the SetFocus method if you use the Microsoft Forms 2.0 ActiveX control
>on a page. But I'm looking for the equivalent code to use with just HTML
>forms?

>Thanks,
>Hossein Mafinejad




Fri, 20 Oct 2000 03:00:00 GMT  
 How to Set Focus to a Form Field

You have to use client-side scripting for that.

<html>
<head>
<script>
function focusMe() {
  document.form1.element1.focus()

Quote:
}

</script>
</head>
<body onLoad="focusMe()">
<form name=form1>
<input type=text name=element1>
</form>
</body>
</html>

Cheers,
Aaron Bertrand
Lead Integrator
w a t e r w o r k s   i n t e r a c t i v e   i n c .
http://www.waterworksia.com/
(reply-to altered)

Quote:

>Does anyone know how to set focus to a field in an HTML form? I know you
can
>use the SetFocus method if you use the Microsoft Forms 2.0 ActiveX control
>on a page. But I'm looking for the equivalent code to use with just HTML
>forms?

>Thanks,
>Hossein Mafinejad




Fri, 20 Oct 2000 03:00:00 GMT  
 How to Set Focus to a Form Field

Quote:

>Does anyone know how to set focus to a field in an HTML form? I know you
can
>use the SetFocus method if you use the Microsoft Forms 2.0 ActiveX control
>on a page. But I'm looking for the equivalent code to use with just HTML
>forms?

>Thanks,
>Hossein Mafinejad




Mon, 30 Oct 2000 03:00:00 GMT  
 How to Set Focus to a Form Field

Curious  to  know  how  to  do  this,  as  I  have  a  very  similar
requirement

Thanks
Sri



Mon, 30 Oct 2000 03:00:00 GMT  
 How to Set Focus to a Form Field

Use Javascript

EX:

Here is the form field

  <FORM NAME="formDimensions">
      <INPUT TYPE="text" SIZE="10" NAME="NumberAcross" VALUE="
</FORM>

Here is some Javascript
<SCRIPT LANGUAGE="JavaScript">
    <!-- Activate Cloaking Device
    //

     function StartUp()
        {
               document.formShape.Shape.focus();
              some other stuff etc.....
         }
     // Deactivate Cloaking  -->
</SCRIPT>

Put this at the very end of your asp

<SCRIPT LANGUAGE="Javascript">
<!--
  StartUp()
//-->
</SCRIPT>

or use the body onload event to call startup or just put the focus call into
the onload event.

Tom


Quote:


>>Does anyone know how to set focus to a field in an HTML form? I know you
>can
>>use the SetFocus method if you use the Microsoft Forms 2.0 ActiveX control
>>on a page. But I'm looking for the equivalent code to use with just HTML
>>forms?

>>Thanks,
>>Hossein Mafinejad




Mon, 30 Oct 2000 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. How do I set focus to a field after form loads

2. setting focus on a form field?

3. How do I set focus to a form field when a HTML page is shown.

4. Set Focus back on field (Access 2000 form)

5. Outlook: Is it possible to set focus to a field

6. Setting Focus to an unknown field

7. passing forms and controls so I can set focus back to a form from a module

8. passing forms and controls so I can set focus back to a form from a module

9. howto place the focus on first text field of form

10. How to Set Focus on specific field in Outlook

11. Setting Focus on TO: field

12. Setting Focus to field and tab

 

 
Powered by phpBB® Forum Software