Solved

Set focus on a textbox and textbox onchange event

Posted on 2001-09-05
5
1,293 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
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…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

624 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