Jump to content

Red becomes Green in avbscript in HTML


Swisswoodstock
 Share

Recommended Posts

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>

Link to comment
Share on other sites

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 " "...

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

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
Link to comment
Share on other sites

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... :)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...