Swisswoodstock 0 Posted November 18, 2005 Report Share Posted November 18, 2005 Hi folksI would like to see some text in red!but: Red is displayed green #ff0000 is displayed #00ff00 #990000 is displayed #009900it works correct for Blue, #0000ff and #000099 is something wrong with my code?Please look at it below and advice!Thanks in advance for any help and kind regards Jürghtml><body><script type="text/vbscript">document.write("<font color="red">this is red</font><br />")document.write("<font color="blue">this is blue</font><br />")document.write("<font color="brown">this is brown</font><br />")document.write("<font color="green">this is green</font><br />")document.write("<font color="#ff0000">this is #ff0000</font><br />")document.write("<font color="#00ff00">this is #00ff00</font><br />")document.write("<font color="#0000ff">this is #0000ff</font><br />")document.write("<font color="#990000">this is #990000</font><br />")document.write("<font color="#009900">this is #009900</font><br />")</script></body></html> Quote Link to post Share on other sites
Jonas 151 Posted November 18, 2005 Report Share Posted November 18, 2005 Don't think it should matter for the colors, but when writing your scripts, you should make use of both the ' and the " signs.document.write('<font color="red">Red color</font>')cause otherwise the browser may get confused where to start and stop the " "... Quote Link to post Share on other sites
Swisswoodstock 0 Posted November 18, 2005 Author Report Share Posted November 18, 2005 This must have happened during drag and drop!the Code in my example uses " (again with spaces: & # 3 4 ; ) red " ... and it is working for Blue!Thanks for the quick answer! and I will try the optin with ' " etc as well!regards Jürg Quote Link to post Share on other sites
Swisswoodstock 0 Posted November 18, 2005 Author Report Share Posted November 18, 2005 This must have happened during drag and drop!the Code in my example uses " (again with spaces: & # 3 4 ; ) red " ... and it is working for Blue!Thanks for the quick answer! and I will try the optin with ' " etc as well!regards Jürg<{POST_SNAPBACK}> You where almost right! just switch the ' and " and I get my text red now!document.write("<font color='red'>this is red</font><br />")Thanks for the hint!Jürg Quote Link to post Share on other sites
Jonas 151 Posted November 18, 2005 Report Share Posted November 18, 2005 Ah, so that was the problem. It was really just a general tips for writing scripts. I had no idea not doing that could change color output... :)Anyway, glad it worked... Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.