View Full Version : Resolved Forms
Andyroo123
11-05-2009, 10:40 PM
Okay, with text boxes in forms, you know how you can have a value before hand, how do you make it gray writing and when you click it, the writing disappears.
Thanks in advance,
Andy
p.s I might add more questions to this topic as I come along to them :)
Try this:
<input type="text" value="Type" style="font-style: italic;color: grey;" onfocus="this.style.fontStyle='normal';this.style.color='black';this.value=''" onblur="this.style.fontStyle='italic';this.style.color='grey';"/>
Andyroo123
11-05-2009, 10:55 PM
Thanks, thats perfect :)
Your welcome. You said you might have more questions? If not:
Please set the status of your topic to resolved.. To do this:
Go to your first post ->
Edit your first post ->
Click "Go Advanced" ->
Then in the drop down next to the title, select "RESOLVED"
Andyroo123
11-05-2009, 10:58 PM
Okay, what about that, but in a text area? because where you put the text is different.
Just put the following in the attributes of the text area:
style="font-style: italic;color: grey;" onfocus="this.style.fontStyle='normal';this.style.color='black';this.value=''" onblur="this.style.fontStyle='italic';this.style.color='grey';"
Andyroo123
11-05-2009, 11:09 PM
I thought so, I was just checking :)
Cheers.
Great! Again, glad to help you!
Please set the status of your topic to resolved.. To do this:
Go to your first post ->
Edit your first post ->
Click "Go Advanced" ->
Then in the drop down next to the title, select "RESOLVED"
Andyroo123
11-05-2009, 11:11 PM
You know how you set it to resolved, can you change it back afterwards, or should I just create a new topic?
Andyroo123
11-06-2009, 04:52 PM
Okay, I found a problem with using that. After you have typed something in a text box then clicked off, it goes grey and itallic, then say, if you made a mistake and you clicked back in there, the whole thing would delete, is there anyway to stop this?
Cheers.
Andy
Yes, there is. But before I make the code, do you want it to turn back to grey? Or just stay black?
Andyroo123
11-06-2009, 10:15 PM
I want it to be grey before you enter anything, then when you click on it and enter stuff to be black, then, when you click off that for it to stay black.
Cheers,
Andy.
Ok:
style="font-style: italic;color: grey;" onfocus="this.style.fontStyle='normal';this.style.color='black';if(!a){this.value=''};" onchange="a = true;"
Then, in the <head> part of your document, add:
<script type="text/javascript">
var a = false;
</script>
Good luck!
Andyroo123
11-07-2009, 04:04 PM
ThankYou MUCHLY :D
jscheuer1
11-07-2009, 04:28 PM
Just a note, 'grey' is not a valid css color name in all browsers, just some. Use 'gray' instead.
Good point! Here:
style="font-style: italic;color: gray;" onfocus="this.style.fontStyle='normal';this.style.color='black';if(!a){this.value=''};" onchange="a = true;"
Andyroo123
11-07-2009, 04:55 PM
Thanks guys, much appreciated :)
Glad to help! Now change the topic to resolved. ;)
Andyroo123
11-07-2009, 11:57 PM
Oh yeah, my bad, I went out after you replied :)
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.