PC Review


Reply
Thread Tools Rate Thread

problem with two </script> tags

 
 
bob
Guest
Posts: n/a
 
      18th Oct 2006
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>


 
Reply With Quote
 
 
 
 
=?Utf-8?B?TGVvbiBNYXluZQ==?=
Guest
Posts: n/a
 
      18th Oct 2006
"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.

 
Reply With Quote
 
bob
Guest
Posts: n/a
 
      18th Oct 2006
Hi, thanks for replying.
I get now the java-error: ; expected



"Leon Mayne" <(E-Mail Removed)> schreef in bericht
news:21BBEB13-C6F5-4C71-BB12-(E-Mail Removed)...
> "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.
>



 
Reply With Quote
 
=?Utf-8?B?TGVvbiBNYXluZQ==?=
Guest
Posts: n/a
 
      18th Oct 2006
"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>"


 
Reply With Quote
 
bob
Guest
Posts: n/a
 
      20th Oct 2006
Thanks, but still javascript error (expected


"Leon Mayne" <(E-Mail Removed)> schreef in bericht
news:A8626523-85A3-4F5F-9344-(E-Mail Removed)...
> "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>"
>
>



 
Reply With Quote
 
=?Utf-8?B?TGVvbiBNYXluZQ==?=
Guest
Posts: n/a
 
      20th Oct 2006
"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?
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error when using <% %>and <script></script> tags -Karl Microsoft ASP .NET 2 18th Jun 2007 04:55 PM
Re: can i run script with <% .. %> tags from inside XSL? Greg Collins [Microsoft MVP] Microsoft ASP .NET 0 25th Oct 2006 06:29 PM
Re: can i run script with <% .. %> tags from inside XSL? Greg Collins [Microsoft MVP] Microsoft ASP .NET 0 25th Oct 2006 06:29 PM
can i run script with <% .. %> tags from inside XSL? =?Utf-8?B?SmFtZXM=?= Microsoft ASP .NET 1 13th Jun 2006 09:51 PM
Using <Script> tags to calls a script from another server Chuck Microsoft ASP .NET 2 12th Nov 2004 11:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:15 PM.