Solved

onFocus event in password input field

Posted on 2008-06-13
2
949 Views
Last Modified: 2008-07-03
his code on my login page:

<input type="text" name="id" value="Your Email Address or Account ID" onFocus="if(this.value=='Your Email Address or Account ID')this.value='';">

<input type="text" name="pw" value="Your Password" onFocus="if(this.value=='Your Password')this.value='';">

I need to use input type=text for the password field so that "Your Password" appears as the value. If I change the type to type=password, then by default the text displayed in the input field is *********************

Is there some way to display "Your Password" in the password field, but when the user starts typing his password, it appears as ********** ?

0
Comment
Question by:cbradstreet
2 Comments
 
LVL 7

Expert Comment

by:ruscomp
ID: 21781358
Try this:
<input type="text" name="pw" value="Your Password" onFocus="if(this.value=='Your Password'){this.value='';this.type='password';}">

Open in new window

0
 
LVL 42

Accepted Solution

by:
David S. earned 125 total points
ID: 21783130
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

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

10 Experts available now in Live!

Get 1:1 Help Now