PDA

View Full Version : calling script from document.write


Thara
04-08-2008, 04:31 PM
Hi,

I am having problem with my javascript using document.write. I will greatly appreciate any help.

I have a test.html page whose body contains following code

<script language="javascript">
document.write('<scr'+'ipt language="javascript" src="http://pscbldev02.trcinc.com:8888/XMLRequest?id=999&crId=1&pid=1&referralurl=WWW.CNN.COM&cip=10.2.32.322&at=-1&zid=-1&cid=-1&schema=JS&kw=KEYWORDS1&fl=1&num=2&start=1"><\/scr'+'ipt>');
</script>

the call to above url in src returns following code.

<script language="javascript" type="text/javascript"
src="http://pscbldev02.trcinc.com:8888/JS/adscript.js" >
</script>
<script language="javascript">window.onload=startRequest; </script>

which is supposed to load http://pscbldev02.trcinc.com:8888/JS/adscript.js and call "startRequest" function.

When I load test.html page I keep getting "missing ; before statement
[Break on this error] <script language="javascript">window.onload=startRequest; </script>"

I have been trying to figure this out from last 24 hours with no luck.

I appreciate any help.

Regards,

Stooshie
04-08-2008, 05:33 PM
All of the URLS appear to be broken links.

Also, there are security issues linking to external scripts which some browsers/settings won't allow you to do.

Thara
04-08-2008, 07:21 PM
Hi Stooshie,

Those are not broken, they are all internal links working as described (intranet).

-Srini

LOLcayter
04-08-2008, 10:40 PM
Why do you need the language="javascript" tag? And on your other script tag you are missing the type="text/javascript" portion.

Stooshie
04-09-2008, 02:05 PM
Is there any reason that you can't just put the second javascript

<script language="javascript" type="text/javascript"
src="http://pscbldev02.trcinc.com:8888/JS/adscript.js" >
</script>

into the test.html page?

Also, without seeing the returned code from adscriot.js I can't tell you much about what is wrong with the code.