daled1
09-26-2011, 08:18 AM
document.write("<script type='text/javascript' src='http://www.website.com/javscript.js'></script>");
For some reason this will not output correctly. It ouputs
");
Which is the last three characters.
daled1
09-26-2011, 09:01 AM
I figured it out. I need to escape the forward slashes
DaveyErwin
09-26-2011, 11:42 AM
You are seeing
");
because the script ends at
</script>
and the browser thinks
");
is html
do it something like this
document.write("<script type='text/javascript' src='javscript.js'></"+"script>");
tpeck
09-26-2011, 01:52 PM
I often use this site for such purposes:
http://www.stevenolte.com/docwriter.html
Dormilich
09-27-2011, 07:34 AM
I wouldn’t use document.write() in this case at all. just put the <script> tag in the HTML. if JavaScript is enabled, the script file is used, if not (which should be quite a low percentage of users), then it’s not used.