problem with two </script> tags

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bob

    #1

    problem with two </script> tags

    Hi,

    This code gives two errors, one on each </scripttag:
    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_It emInserted(ByVa l sender As Object, ByVal e As
    System.Web.UI.W ebControls.Deta ilsViewInserted EventArgs)
    Dim jv As String
    jv = "<script type='text/javascript' language='javas cript'>" _
    & " alert('Thanks, data are in');" _
    & "</script>"
    Response.Write( jv)
    End Sub
    </script>


  • Leon Mayne

    #2
    RE: problem with two &lt;/script&gt; tags

    "bob" wrote:
    This code gives two errors, one on each </scripttag:
    the first: "statement cannot appear in method body"
    the last: "end of tag has no matching start tag"
    <script runat="server">
    Protected Sub DetailsView1_It emInserted(ByVa l sender As Object, ByVal e As
    System.Web.UI.W ebControls.Deta ilsViewInserted EventArgs)
    Dim jv As String
    jv = "<script type='text/javascript' language='javas cript'>" _
    & " 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.

    Comment

    • bob

      #3
      Re: problem with two &lt;/script&gt; tags

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



      "Leon Mayne" <LeonMayne@disc ussions.microso ft.comschreef in bericht
      news:21BBEB13-C6F5-4C71-BB12-A91AE5642D99@mi crosoft.com...
      "bob" wrote:
      >This code gives two errors, one on each </scripttag:
      >the first: "statement cannot appear in method body"
      >the last: "end of tag has no matching start tag"
      ><script runat="server">
      >Protected Sub DetailsView1_It emInserted(ByVa l sender As Object, ByVal e
      >As
      >System.Web.UI. WebControls.Det ailsViewInserte dEventArgs)
      >Dim jv As String
      >jv = "<script type='text/javascript' language='javas cript'>" _
      >& " 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.
      >

      Comment

      • Leon Mayne

        #4
        Re: problem with two &lt;/script&gt; tags

        "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='javas cript'>" &
        Environment.New Line & _
        " alert('Thanks, data are in')" & Environment.New Line & _
        "</scr" & "ipt>"


        Comment

        • bob

          #5
          Re: problem with two &lt;/script&gt; tags

          Thanks, but still javascript error (expected ;)


          "Leon Mayne" <LeonMayne@disc ussions.microso ft.comschreef in bericht
          news:A8626523-85A3-4F5F-9344-DCA8EF51F1C6@mi crosoft.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='javas cript'>" &
          Environment.New Line & _
          " alert('Thanks, data are in')" & Environment.New Line & _
          "</scr" & "ipt>"
          >
          >

          Comment

          • Leon Mayne

            #6
            Re: problem with two &lt;/script&gt; tags

            "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?

            Comment

            Working...