vytas Posted December 31, 2006 Share Posted December 31, 2006 I want to use the GetElementById tag to change the appearance of the textSuch as: <html><head><style type="text/css">p {color: green}</style></head><body><p id="text">Hello and Welcome to my site</p><script type="text/javascript">{var r= get Hours()if (r<=15){document.GetElementById("text") (and here i dont know how to acces the color of my text)}}</script></body></html> Pls i need some help Link to comment Share on other sites More sharing options...
feck Posted December 31, 2006 Share Posted December 31, 2006 Hopefully this helps.document.GetElementById("text").style.color = 'whatever color you wish'; Link to comment Share on other sites More sharing options...
vytas Posted December 31, 2006 Author Share Posted December 31, 2006 I didn't work maybe an error in my script ??? <html><head><style type="text/css">p {color: green}</style></head><body><p id="text">Hello and Welcome to my site</p><script type="text/javascript">{var r= getHours()if (r<=18){document.GetElementById("text").style.color ="red";}else{document.style.GetElementById("text").color ="red";}}</script></body></html> This is what i have now but it still didn't workI fixed the problemthank you Link to comment Share on other sites More sharing options...
Andrew K. Posted January 1, 2007 Share Posted January 1, 2007 The 'G' in 'Get' is supposed to be lowercase.And document.style.GetElementById("text").color ="red"; won't do anything. Link to comment Share on other sites More sharing options...
vytas Posted January 1, 2007 Author Share Posted January 1, 2007 yeay thx i fixed the script it is working Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now