problem with two </script> tags

B

bob

Hi,

This code gives two errors, one on each </script> tag:
the first: "statement cannot appear in method body"
the last: "end of tag has no matching start tag"

Any way to solve this?
Thanks
Bob

<script runat="server">
Protected Sub DetailsView1_ItemInserted(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DetailsViewInsertedEventArgs)
Dim jv As String
jv = "<script type='text/javascript' language='javascript'>" _
& " alert('Thanks, data are in');" _
& "</script>"
Response.Write(jv)
End Sub
</script>
 
G

Guest

bob said:
This code gives two errors, one on each </script> tag:
the first: "statement cannot appear in method body"
the last: "end of tag has no matching start tag"
<script runat="server">
Protected Sub DetailsView1_ItemInserted(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DetailsViewInsertedEventArgs)
Dim jv As String
jv = "<script type='text/javascript' language='javascript'>" _
& " alert('Thanks, data are in');" _
& "</script>"
Response.Write(jv)
End Sub
</script>

Sounds like an IDE bug. You could do something like:

& " alert('Thanks, data are in');" _
& "</sc" & "ript>"

Which may trick the IDE into thinking it isn't a closing tag.
 
G

Guest

bob said:
Hi, thanks for replying.
I get now the java-error: ; expected

Looks like the Javascript is wrong, try this:

jv = "<script type='text/javascript' language='javascript'>" &
Environment.NewLine & _
" alert('Thanks, data are in')" & Environment.NewLine & _
"</scr" & "ipt>"
 
B

bob

Thanks, but still javascript error (expected ;)


Leon Mayne said:
Looks like the Javascript is wrong, try this:

jv = "<script type='text/javascript' language='javascript'>" &
Environment.NewLine & _
" alert('Thanks, data are in')" & Environment.NewLine & _
"</scr" & "ipt>"
 
G

Guest

bob said:
Thanks, but still javascript error (expected ;)

Works OK for me. Do you have any other scripts on the page? Could you do a
'View source' in IE when you get the error and post the complete <script>
section that's causing the problem?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top