RFSumerall Posted July 10, 2012 Share Posted July 10, 2012 I'm styling a login, and I've just about got it. I've run into a problem, and I can't find anything helpful on the issue. I has the values for the form set to "Username" and "Password" to prompt users. I already have onfocus and onblur affecting it. How can I change the input type to password when a user inputs their password? Just to clarify, I'm not necessarily asking for the code itself. I would love an article/reference website that I can learn from. Thanks,Rebecca Here is the code I have: <div id="login"> <form method=post action="http://host.onlineprintsolutions.com/gandyprinters/login.asp"> <input onfocus="if(this.value == 'Username'){this.value = '';}" type="text" onblur="if(this.value == ''){this.value='Username';}" id="name" value="Username" /> <input onfocus="if(this.value == 'Password'){this.value = '';}" type="text" onblur="if(this.value == ''){this.value='Password';}" id="name" value="Password" /> <input class="clsSubmit" type=submit value="Go" id=submit1 name=submit1 onClick="if ((user.value=='') && (password.value=='')){alert('Please enter your user name & password');return false}"> </form></div> Link to comment Share on other sites More sharing options...
birbal Posted July 10, 2012 Share Posted July 10, 2012 you can change the this.value property on event. when it focus make it "password" else "text" Link to comment Share on other sites More sharing options...
RFSumerall Posted July 10, 2012 Author Share Posted July 10, 2012 Thanks so much! That did it for me Have a good day! Link to comment Share on other sites More sharing options...
thescientist Posted July 10, 2012 Share Posted July 10, 2012 (edited) or you can just use HTML input type="password"http://www.w3schools..._input_type.asp edit: nm, read to fast and thought you were looking for password obfuscation Edited July 10, 2012 by thescientist Link to comment Share on other sites More sharing options...
ShadowMage Posted July 10, 2012 Share Posted July 10, 2012 nm, read to fast and thought you were looking for password obfuscationI've read it about 8 times and that's still what it sounds like OP is looking for.... :umnik2:Apparently I'm missing something though, because it seems the issue is resolved. Link to comment Share on other sites More sharing options...
justsomeguy Posted July 10, 2012 Share Posted July 10, 2012 She's trying to toggle the field between "text" and "password", so that when it is "text" she can display the word "Password" inside the field as a label instead of having a label outside the field. Focusing the field would change the input type from text to password and remove the text already in it. Link to comment Share on other sites More sharing options...
thescientist Posted July 10, 2012 Share Posted July 10, 2012 I've read it about 8 times and that's still what it sounds like OP is looking for.... :umnik2:Apparently I'm missing something though, because it seems the issue is resolved.well, rereading the topic title suggests i was right... but the post suggests they were asking another problem altogether Making password display as *** without affecting the initial value Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now