Home All Groups Group Topic Archive Search About

problem with two </script> tags

Author
18 Oct 2006 9:39 AM
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>

Author
18 Oct 2006 1:18 PM
Leon Mayne
Show quote Hide quote
"bob" wrote:
> 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.
Author
18 Oct 2006 1:52 PM
bob
Hi, thanks for replying.
I get now the java-error: ; expected



Show quoteHide quote
"Leon Mayne" <LeonMa***@discussions.microsoft.com> schreef in bericht
news:21BBEB13-C6F5-4C71-BB12-A91AE5642D99@microsoft.com...
> "bob" wrote:
>> 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.
>
Author
18 Oct 2006 3:51 PM
Leon Mayne
"bob" wrote:
> 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>"
Author
20 Oct 2006 6:48 AM
bob
Thanks, but still javascript error (expected ;)


Show quoteHide quote
"Leon Mayne" <LeonMa***@discussions.microsoft.com> schreef in bericht
news:A8626523-85A3-4F5F-9344-DCA8EF51F1C6@microsoft.com...
> "bob" wrote:
>> 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>"
>
>
Author
20 Oct 2006 7:46 AM
Leon Mayne
"bob" wrote:
> 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?