NYCPHP Meetup

NYPHP.org

[nycphp-talk] Removing Text from an Input Box

Andy Dirnberger dirn at dirnonline.com
Wed Jun 6 20:59:24 EDT 2007


I think this will work in some browsers, but not all.  I believe to
accomplish this in IE you'd have to completely replace the <input
type="text" . /> with <input type="password" . />.

 

From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On
Behalf Of Ben Sgro (ProjectSkyline)
Sent: Wednesday, June 06, 2007 8:54 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Removing Text from an Input Box

 

Hello, 

 

Yeah, I just hacked up this:

 

. "<input type=\"text\" value=\"Username\" onfocus=\"this.value=''\">"
                       . "<input type=\"text\" value=\"Password\"
onfocus=\"this.value=''\" onfocus=\"this.type='password'\">"

 

What im trying to do is turn that type to a password..so I can see the
text...is that possible.

 

- Ben

 

Ben Sgro, Chief Engineer
ProjectSkyLine - Defining New Horizons
----- Original Message ----- 

From: Andy Dirnberger <mailto:dirn at dirnonline.com>  

To: 'NYPHP Talk' <mailto:talk at lists.nyphp.org>  

Sent: Wednesday, June 06, 2007 8:47 PM

Subject: RE: [nycphp-talk] Removing Text from an Input Box

 

I usually do something like the following to clear the value.  Keep in mind
that when the type is set to password your text will always display masked.

 

DiRN

 

<input onfocus="clearText (this);" />

 

<script type="text/javascript">

  function clearText (el) {

    if (el.defaultValue == el.value) el.value = "";

  }

</script>

 

From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On
Behalf Of Ben Sgro (ProjectSkyline)
Sent: Wednesday, June 06, 2007 8:44 PM
To: NYPHP Talk
Subject: [nycphp-talk] Removing Text from an Input Box

 

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20070606/c550c62a/attachment.html>


More information about the talk mailing list