or... <script> function clearField(id, value) { if (id.value == value) { id.value = ""; } } function restoreField(id, value) { if (id.value == "") { id.value = value; } if (id.type == "text" && id.id == "pwrd" && id.value != "Password"){ id.type = "password"; } else { id.type = "text"; } } </script>
----- Original Message ----- From: "Andy Dirnberger" <[EMAIL PROTECTED]> To: "'NYPHP Talk'" <talk@lists.nyphp.org> Sent: Wednesday, June 06, 2007 9:08 PM Subject: RE: [nyphp-talk] Removing Text from an Input Box > Something along these lines should work. > > <div id="passwordcontainer"> > <input type="text" value="Password" onfocus="swapOut ('passwordcontainer', > 'password');" /> > </div> > > function swapOut (container_id, field_name) { > var el = document.getElementById (container_id); > el.innerHTML = "<input type='password' name='" + field_name + "' />"; > } > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On > Behalf Of Mark Armendariz > Sent: Wednesday, June 06, 2007 9:02 PM > To: 'NYPHP Talk' > Subject: RE: [nyphp-talk] Removing Text from an Input Box > > >> From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Ben Sgro (ProjectSkyline) > > What im trying to do is turn that type to a password..so I can see > the text...is that possible. > > > > Yes it is possible to change a field type to text and then back to password > in Firefox, but you'll get errors from IE and opera. They don't like the > idea of changing form field types. > > The way I've gotten around this is by creating an new field (innerHtml), > using the old field's values, and then replacing the old field. It's a lot > easier than it sounds using a framwork's insertion methods > (prototype::Insertion.Before), though shouldn't terribly difficult using > straight javascript. > > Mark > > _______________________________________________ > 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 > > > _______________________________________________ > 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 > > _______________________________________________ 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