NYCPHP Meetup

NYPHP.org

[nycphp-talk] Removing Text from an Input Box

Patrick May patrick at hexane.org
Wed Jun 6 21:02:42 EDT 2007


Now your passwords are screen-visible....

<script>
function clearField(id, value) {
   if (id.value == value) {
     id.value = "";
   }
}
function restoreField(id, value) {
   if (id.value == "") {
     id.value = value;
   }
}
</script>

<input type="text" value="Username" onMouseOver="clearField(this,  
'Username')" onMouseOut="restoreField(this, 'Username')">
<input type="text" value="Password" onMouseOver="clearField(this,  
'Password')" onMouseOut="restoreField(this, 'Password')">



On Jun 6, 2007, at 8:44 PM, Ben Sgro ((ProjectSkyline)) wrote:

> Hello,
>
> This is more of a JS question, but I'm going to ask it anyways.
>
> I just got the book, "Pro Javascript Techniques" (Apress) and what  
> sucks is that many of
> the examples do not work.
>
> What I want to do is have to input boxes, a username and password.
> Instead of having labels next to them such as:
>
> Username: [INPUT BOX]
> Password: [INPUT BOX]
>
> I want to have the text inside the box [INPUT BOX: Username]. etc...
>
> When the user mouses over, I want to make that "Username" text  
> dissapear so they can type their username in.
>
> Any help?
>
> - Ben
>
> Ben Sgro, Chief Engineer
> ProjectSkyLine - Defining New Horizons
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php




More information about the talk mailing list