Solved

Set focus on a textbox and textbox onchange event

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
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…

679 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