Solved

Set focus on a textbox and textbox onchange event

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Diminish Pop-up  in 3 seconds 7 77
Designing forms 3 70
MS SQL and inserting dates into tables using stored procedures 6 45
Validating number not work with decimal 4 46
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…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

752 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