iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-03-2008, 03:48 PM
WebProWorld Pro
 
Join Date: Aug 2007
Location: Stuttgart Germany
Posts: 174
kruser RepRank 1
Default JavaScript Error

Hello,

Can anyone tell me why this Javascript line is causing an error. I think it is the hyphen between background and color. If it is how do I work with that?

Code:
document.getElementById('sign').style.background-color="White";
__________________
Best Regards,
Randy
Reply With Quote
  #2 (permalink)  
Old 09-03-2008, 04:04 PM
wige's Avatar
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,648
wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9
Default Re: JavaScript Error

Try
Code:
document.getElementById('sign').style='background-color: white';
__________________
The best way to learn anything, is to question everything.
Reply With Quote
  #3 (permalink)  
Old 09-03-2008, 04:48 PM
WebProWorld Pro
 
Join Date: Aug 2007
Location: Stuttgart Germany
Posts: 174
kruser RepRank 1
Default Re: JavaScript Error CSS background color

Apparently the hyphen does cause an error with javascript when used that way. A solution is to change "background-color" to "backgroungColor".

Code:
document.getElementById('sign').style.backgroundColor= "white" ;
This would change the div background color styling (id="sign") to white.

Thanks for the input wige as it led me in a good direction.
__________________
Best Regards,
Randy
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
AJAX and javascript calling javascript krnl Web Programming Discussion Forum 14 11-18-2007 11:00 AM
Javascript Error Evic WebProWorld: Guidelines/Announcements/Suggestions 3 08-09-2005 11:36 AM
Runtime Error - Line 1 - Error Syntex Error charms987 Graphics & Design Discussion Forum 6 07-29-2005 12:56 PM
Javascript form calculation error twopooches Web Programming Discussion Forum 1 02-13-2005 11:44 PM
Two browsers, one javascript error mikmik Web Programming Discussion Forum 4 03-15-2004 09:53 PM


All times are GMT -4. The time now is 11:57 PM.



Search Engine Optimization by vBSEO 3.3.0