Jump to content
Swisswoodstock

Red becomes Green in avbscript in HTML

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>

Share this post


Link to post
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 " "...

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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... :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...