Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 4th, 2006, 10:03 AM
Authorized User
 
Join Date: Nov 2005
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



 
Old July 4th, 2006, 12:39 PM
Friend of Wrox
 
Join Date: Nov 2005
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
 
Old July 5th, 2006, 05:40 AM
S1v S1v is offline
Registered User
 
Join Date: Jul 2006
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.






Similar Threads
Thread Thread Starter Forum Replies Last Post
SetFocus on a textbox when form load snowydust VB How-To 9 February 10th, 2017 12:43 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 11:45 AM
Subform Setfocus Steven Access 4 June 11th, 2003 12:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.