Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

focus()

Status
Not open for further replies.

JustWondering

Technical User
Jun 28, 2003
57
0
0
US
Hi:

What is the eqhivalent ASP code in server site for this statement:

Document.Form.txtName.focus() ?

Thanks
 
The equivalent is:
Code:
Document.Form.txtName.focus()
That’s because on the server there is no Document object nor Form object. There are only server side objects. Therefore there are no window controls to set the focus on. Then the server processing results in HTML text that is streamed back to the browser. Upon parsing the HTML text, the browser instantiates the DOM objects.

-pete
 
You could include that JavaScript command in the text stream palbano mentions though..
Code:
Response.Write(&quot;<body onload=&quot;&quot;Document.Form.txtName.focus();&quot;&quot;>&quot;)

Posting code? Wrap it with code tags: [ignore]
Code:
[/ignore][code]CodeHere
[ignore][/code][/ignore].
 
clarkin
&quot;You could include...&quot;

Are you suggesting there is another way to get the script to the browser besides streaming it or a <script src=&quot;&quot;> tag to the browser from the ASP page?

-pete
 
palbano: nope :)

&quot;You could include...&quot;
Just being polite. The unspoken other option was not including it, and not some other magic way of calling client-side objects from your server-side script.

[smilejap]

Posting code? Wrap it with code tags: [ignore]
Code:
[/ignore][code]CodeHere
[ignore][/code][/ignore].
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top