Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using <script> tag when using win.document.write(' ... ');

Status
Not open for further replies.

Butser

Programmer
Joined
Feb 17, 2006
Messages
8
Location
GB
Hi,

I would like to include a javascript function in a popup window. However, IE returns the following error "unterminated string constant" when I use the following code: "win.document.write('<script>');".

Hope that I have provided sufficient details of the problem and would be grateful for any help.

Regards,
James.
 
Always break up your script tags when you are using them in a document.write statement:
Code:
win.document.write("<scr" + "ipt>");
Otherwise your code thinks you are starting a new <script> tag.
[small]The same holds true for </script> tags[/small]

-kaht

[small] <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B>[/small]
[banghead] [small](He's back)[/small]
 
thanks for your help - this resolved the problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top