Reputation: 534
We are currently in the process of translating our VBScript to javascript and one of the steps is to remove single quotes '
and use double quotes instead "
.
I have the following line of code in the HTML header:
document.write("<div style='position:absolute;padding-left:10px;padding-top:50px;color:red;font-size:13pt' id='divtest'><%=resxPleaseWait%><marquee style='border-top:solid 1px black' DIRECTION=RIGHT BEHAVIOR=SCROLL SCROLLAMOUNT=10 SCROLLDELAY=200>.</marquee> </div>")
This used to be VB script but is now being written as JS.
Further down the page the ID divtest
is called. In replacing the single quotes this functionality breaks and I cannot think of an alternative. Any ideas?
Upvotes: 0
Views: 379
Reputation: 624
You can use DoubleQuotes " in your javascript by escaping them like this \".
document.write("<div style=\"position:absolute;padding-left:10px;padding-top:50px;color:red;font-size:13pt\" id=\"divtest\"><%=resxPleaseWait%> <marquee style=\"border-top:solid 1px black\" DIRECTION=\"RIGHT\" BEHAVIOR=\"SCROLL\" SCROLLAMOUNT=\"10\" SCROLLDELAY=\"200\">.</marquee> </div>")
The errors you are experiencing may have been caused by not placing quotes around the marquee properties. I corrected this too in the above code.
Upvotes: 1