PDA

View Full Version : Javascript Questions



TheAngryTomato
28 Nov 2007, 07:25 PM
I have an area on a website I am developing that I would like a deal of some sort to display in. I want it so that when you change the deal, it will change on every page instead of just the one you edited. So, I created a .js file that I stored the text in and hoped it would write it to the screen so I can just change it once. In the actual HTML doc I have:



<script language="JavaScript" src="deals.js"></script>


The 'deals.js' file says:



var txt = "<B>New!<B> - Skil Digital Angle Finder - <font color = "red"><b>$49.99</b></font> - <font color = "black"><a href="blah">More</a></font>"
document.write(txt)


My javascript skills are very rudimentary, and because so, this doesn't work and I don't know why. Any suggestions?

EDIT: Upon debugging I found that I cant have <font color = "red"> tags or stuff like that because of the "". I don't even know if the <b> tags work. Is there a way around this?

-TheAngryTomato

dr_smith
05 Dec 2007, 10:12 AM
Try using single quotes instead. This often solves a lot of problems with JavaScript.