Jump to content

changing form values


elmas156

Recommended Posts

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';}\"> ";

?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.