You might have seen this error when using ASP to generate client-side script:
Active Server Pages, ASP 0138 (0x80004005) A script block cannot be placed inside another script block. |
This probably happened because you did this:
<script language=vbscript runat=server> Response.Write "<script>alert('foo');</script>" </script> |
Or this:
<script language=jscript runat=server> Response.Write("<script>alert('foo');</script>"); </script> |
One way to alleviate this is to use the @language directive and use <%%> delimiters throughout:
<% @language="vbscript" %> <% Response.Write "<script>alert('foo');</script>" %> |
Or this:
<% @language="jscript" %> <% Response.Write("<script>alert('foo');</script>"); %> |
If you are using both languages in the same page, you may have to use this alternative workaround, where you break the script tags up:
<script language=vbscript runat=server> Response.Write "<scr" & "ipt>alert('foo');</scr" & "ipt>" </script> |
Or this:
<script language=jscript runat=server> Response.Write("<scr" + "ipt>alert('foo');</scr" + "ipt>"); </script> |