Thursday, May 23, 2024
 Popular · Latest · Hot · Upcoming
131
rated 0 times [  132] [ 1]  / answers: 1 / hits: 27452  / 13 Years ago, mon, september 26, 2011, 12:00:00

Does anyone know of a good small piece of code that will prefill my user and pass input box with the text username and password. I've seen so jscript that will do it but i'm looking for something that is a few lines a code.



similar to how the search text is in the search box up top on the right


More From » html

 Answers
57

You can use the following:



<input type=text style=color:#ccc; value=username onfocus=this.value = this.value=='username' ? '' : this.value; this.style.color='#000'; onfocusout=this.value = this.value == '' ? this.value = 'username' : this.value; this.value=='username' ? this.style.color='#ccc' : this.style.color='#000'/>

<input type=text style=color:#ccc; value=password onfocus=this.value = this.value=='password' ? '' : this.value; this.style.color='#000'; onfocusout=this.value = this.value == '' ? this.value = 'password' : this.value; this.value=='password' ? this.style.color='#ccc' : this.style.color='#000'/>

[#89928] Friday, September 23, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
aubreeg

Total Points: 437
Total Questions: 102
Total Answers: 102

Location: Colombia
Member since Mon, May 2, 2022
2 Years ago
;