Solved

Set focus on a textbox and textbox onchange event

Posted on 2001-09-05
5
1,247 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now