Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 4th, 2006, 10:03 AM
Authorized User
 
Join Date: Nov 2005
Location: , , Spain.
Posts: 72
Thanks: 3
Thanked 0 Times in 0 Posts
Default Setfocus on textbox

Hi,

I have a textbox on the screen, after reloading the page I want to cursor to be focused on the textbox, so that they donñy have to use the mouse.
I tried several thing, with no luck. Any help is welcome!!!

My code is:

===
<form name="startform" ACTION="registrarentrada.asp" METHOD=POST>
<TABLE width="442">
<tr>
  <td width="382"> <span class="style8">
    <INPUT NAME="EMPLEADO" TYPE="TEXT" >
      CÓDIGO EMPLEADO</span></td>
</tr>
....
</form>
===

Johny



Reply With Quote
  #2 (permalink)  
Old July 4th, 2006, 12:39 PM
Friend of Wrox
 
Join Date: Nov 2005
Location: Rotterdam, , Netherlands.
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You'll need clientside javascript for this. I don't have an example for this right now try looking for onload javascript functions

__________________________________________________ ________
This is my junk I'm gona eat it
Reply With Quote
  #3 (permalink)  
Old July 5th, 2006, 05:40 AM
S1v S1v is offline
Registered User
 
Join Date: Jul 2006
Location: Chennai, , India.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try this...


<html>
<head>

<script language="JavaScript">
function setFocus()
{
    startform.EMPLEADO.focus()
}
</script>

</head>
<body onLoad="setFocus()">
<form name="startform" ACTION="registrarentrada.asp" METHOD=POST>
<TABLE width="442">
<tr>
  <td width="382"> <span class="style8">
    <INPUT NAME="EMPLEADO" TYPE="TEXT">
      CÓDIGO EMPLEADO</td>
</tr>
</form>
</body>
</html>

Add the code that appears in Bold Face to you already existing code.

Warning: If you have Windows XP with SP3 installed, you will receive a security warning when this page loads.

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
SetFocus on a textbox when form load snowydust VB How-To 8 August 28th, 2008 10:13 AM
Setfocus on Pocket PC rtr1900 Classic ASP Basics 0 October 2nd, 2006 02:29 AM
ListBox SetFocus Clive Astley Access 7 May 5th, 2004 11:07 AM
Setfocus from button on Commandbar simmy Access VBA 2 December 29th, 2003 10:45 AM
Subform Setfocus Steven Access 4 June 11th, 2003 12:38 AM



All times are GMT -4. The time now is 08:23 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.