Solved

Set focus on a textbox and textbox onchange event

Posted on 2001-09-05
5
1,270 Views
Last Modified: 2008-03-17
How to always set focus to a textbox in case i need to enter data continuing?

Can i do textbox on change or lostfoucs event in ASP? and how? VBScript? Javascript? and any example?

0
Comment
Question by:suling16
  • 2
5 Comments
 
LVL 6

Expert Comment

by:JonFish85
ID: 6459779
using javascript:

<INPUT type=text onblur="if (this.value != 'password') { this.focus(); }">

you can do this using ASP, as it runs on the server, so it doesnt actually work with objects on the page...

hope this helps!
0
 
LVL 1

Expert Comment

by:sandaruwan
ID: 6460240
Yes JonFish85, your method is good. But cursor will be at the begining of the text that already typed. So continues data entry is difficult as suling16 wants.

I don't know any way to move cursor to the end of the text. But if you wan't to overwrite the existing text that can be done by using select methid.

eg:
<INPUT type=text onblur="this.select();this.focus();">

Anyone have a better idea?

- Sandaruwan -  
0
 
LVL 6

Accepted Solution

by:
JonFish85 earned 50 total points
ID: 6461153
try this:

<INPUT type=text onblur="if (this.value != 'password') { this.focus(); this.value=this.value;}">

hope this helps!
0
 
LVL 7

Expert Comment

by:lavinder
ID: 8804759
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept a comment - johnfish85
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
lavinder
EE Cleanup Volunteer
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Choose the older file FSO 6 50
Question about ASP Including Files 6 61
Insert Button on a table 16 37
Filktering Alphabetically 8 29
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question