elmas156 Posted September 15, 2010 Share Posted September 15, 2010 I have a form for a sign in page that I want the label for the form field to actually be displayed in the text box and clear when the box is selected to enter text. I've accomplished this using the code below and it works fine. The problem that I'm having is in IE the password field does not change to display dots or asterisk in place of each character. It works fine in Fire Fox but not in IE. Is there way to accomplish this using php or so that it is compatible with most browsers? Here's the code that I'm using: <?php echo "<input type=\"text\" name=\"pword\" size=\"17\" value=\"Password...\" style=\"color: #999999\" onfocus=\"if (this.value == 'Password...') {this.value=''; this.style.color='#000000'; this.type='password';}\"> "; ?> Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted September 16, 2010 Share Posted September 16, 2010 Why don't you just set the HTML attribute type to password instead of text? Even though it will say "********" by default, I'm pretty sure people will realize it's a password, even more so if it's below a text box that says "Username". As to your question for a PHP solution to your problem. No there isn't. It needs to be client-side, so JavaScript. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.