Go Back   Dynamic Drive Forums > General Coding > HTML
Search Dynamic Drive Forums:

Reply
 
Thread Tools Search this Thread
  #11  
Old 11-06-2009, 04:52 PM
Andyroo123 Andyroo123 is offline
Junior Coders
 
Join Date: Nov 2009
Posts: 12
Thanks: 5
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #12  
Old 11-06-2009, 08:10 PM
Nile's Avatar
Nile Nile is offline
Elite Coders
 
Join Date: Jan 2008
Posts: 3,007
Thanks: 10
Thanked 442 Times in 438 Posts
Blog Entries: 5
Default

Yes, there is. But before I make the code, do you want it to turn back to grey? Or just stay black?
__________________
Coding is just another puzzle. And it's okay to have help putting together some peices.
Please don't be afraid to ask.
I try to highlight my code with correct syntax highlighting. Unless the its too long. Or I'm to busy.
Reply With Quote
  #13  
Old 11-06-2009, 10:15 PM
Andyroo123 Andyroo123 is offline
Junior Coders
 
Join Date: Nov 2009
Posts: 12
Thanks: 5
Thanked 0 Times in 0 Posts
Default

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.
Reply With Quote
  #14  
Old 11-07-2009, 03:41 PM
Nile's Avatar
Nile Nile is offline
Elite Coders
 
Join Date: Jan 2008
Posts: 3,007
Thanks: 10
Thanked 442 Times in 438 Posts
Blog Entries: 5
Default

Ok:
Code:
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:
Code:
<script type="text/javascript">
var a = false;
</script>
Good luck!
__________________
Coding is just another puzzle. And it's okay to have help putting together some peices.
Please don't be afraid to ask.
I try to highlight my code with correct syntax highlighting. Unless the its too long. Or I'm to busy.
Reply With Quote
The Following User Says Thank You to Nile For This Useful Post:
Andyroo123 (11-07-2009)
  #15  
Old 11-07-2009, 04:04 PM
Andyroo123 Andyroo123 is offline
Junior Coders
 
Join Date: Nov 2009
Posts: 12
Thanks: 5
Thanked 0 Times in 0 Posts
Default

ThankYou MUCHLY
Reply With Quote
  #16  
Old 11-07-2009, 04:28 PM
jscheuer1's Avatar
jscheuer1 jscheuer1 is offline
No Kidding?
 
Join Date: Mar 2005
Location: SE PA USA
Posts: 18,998
Thanks: 19
Thanked 1,133 Times in 1,119 Posts
Blog Entries: 3
Default

Just a note, 'grey' is not a valid css color name in all browsers, just some. Use 'gray' instead.
__________________
WWWWWWWWWWWW
- John
________________________

Really Show Your Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Reply With Quote
The Following User Says Thank You to jscheuer1 For This Useful Post:
Andyroo123 (11-07-2009)
  #17  
Old 11-07-2009, 04:32 PM
Nile's Avatar
Nile Nile is offline
Elite Coders
 
Join Date: Jan 2008
Posts: 3,007
Thanks: 10
Thanked 442 Times in 438 Posts
Blog Entries: 5
Default

Good point! Here:
Code:
style="font-style: italic;color: gray;" onfocus="this.style.fontStyle='normal';this.style.color='black';if(!a){this.value=''};" onchange="a = true;"
__________________
Coding is just another puzzle. And it's okay to have help putting together some peices.
Please don't be afraid to ask.
I try to highlight my code with correct syntax highlighting. Unless the its too long. Or I'm to busy.
Reply With Quote
The Following User Says Thank You to Nile For This Useful Post:
Andyroo123 (11-07-2009)
  #18  
Old 11-07-2009, 04:55 PM
Andyroo123 Andyroo123 is offline
Junior Coders
 
Join Date: Nov 2009
Posts: 12
Thanks: 5
Thanked 0 Times in 0 Posts
Default

Thanks guys, much appreciated
Reply With Quote
  #19  
Old 11-07-2009, 06:24 PM
Nile's Avatar
Nile Nile is offline
Elite Coders
 
Join Date: Jan 2008
Posts: 3,007
Thanks: 10
Thanked 442 Times in 438 Posts
Blog Entries: 5
Default

Glad to help! Now change the topic to resolved.
__________________
Coding is just another puzzle. And it's okay to have help putting together some peices.
Please don't be afraid to ask.
I try to highlight my code with correct syntax highlighting. Unless the its too long. Or I'm to busy.
Reply With Quote
The Following User Says Thank You to Nile For This Useful Post:
Andyroo123 (11-07-2009)
  #20  
Old 11-07-2009, 11:57 PM
Andyroo123 Andyroo123 is offline
Junior Coders
 
Join Date: Nov 2009
Posts: 12
Thanks: 5
Thanked 0 Times in 0 Posts
Default

Oh yeah, my bad, I went out after you replied
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:15 PM.

Home - Contact Us - Archives - Link to DD - Top 

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.