Solved

onFocus event in password input field

Posted on 2008-06-13
2
955 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Firing an ASP.NET event on selection of a JQuery datepicker 4 31
Add or delete table rows 10 54
Filktering Alphabetically 8 32
html border input line 7 16
This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

828 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