/ Published in: JavaScript
URL: http://discoapp.com/beta/
Expand |
Embed | Plain Text
<input id="1" name="post[email]" value="E-mail Address" style="width:100%; text-align: center; color: grey; margin-bottom: 10px;" onblur="if (this.value == '') {this.value = 'E-mail Address'; document.getElementById(1).style.color = 'grey';}" onfocus="if (this.value == 'E-mail Address') {this.value = ''; document.getElementById(1).style.color = '#000000'; }" />
Comments
Subscribe to comments
You need to login to post a comment.

There's big hole in your code men , when you load it first time it show the gray color 'E-mail Address' but when you just click on textbox and don't put any text in it , the textbox rewrites itself with 'E-mail Address' but text color is black and not gray which it should be. Hopefully you understand what i say. Well plz reply if you find a way out of that error.
Rohit, just change document.getElementById(1) into this:
`
`
<input id="1" name="post[email]" value="E-mail Address" style="width:100%; text-align: center; color: grey; margin-bottom: 10px;" onblur="if (this.value == '') {this.value = 'E-mail Address'; this.style.color = 'grey';}" onfocus="if (this.value == 'E-mail Address') {this.value = ''; this.style.color = '#000000'; }" />