Script Error

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

    Script Error

    Hi,

    I have this JavaScript that is supposed to show random products from my
    database, and show something different every time you refresh or revisit.
    But I keep getting an error - on my computer - that says Syntax Error in
    Line 2.

    There is no error on most other computers, and the products show, but
    another script on the page, an article title scroller, stops - on most
    computers, but not all. It says "no articles available".

    I've tried the script on an asp page and a htm page, all by itself, but it
    still doesn't work. I tried changing all kinds of settings in my browsers,
    but nothing helps. I'm on XP, SP2, which I've heard has some problems
    handling javascripts. I don't know if that's true, but if it is, I know that
    lots of other people will have the same problem as me when they view the
    page. Actually, I think it is a good thing, that my computer is pointing out
    this error. I get the error message in IE6, but in NS8 and FF, I just don't
    see the products. No error message.

    Anyway, here are the first three lines of the script:

    <%
    if TRIM(request.se rvervariables(" http_referer")) = "" then
    %>

    Using spellcheck, I found that referer is spelled wrong, it should be
    referrer. I don't know if that is right for javascript (or asp?), but
    correcting it didn't make a difference.

    The script is JavaScript on an asp page, and it is called in an htm page.

    Is the error obvious from the 3 lines?

    Thanks for any help,

    JA



  • McKirahan

    #2
    Re: Script Error

    "JA" <jarmour@kc.rr. com> wrote in message
    news:zcXKe.5694 $32.3205@tornad o.rdc-kc.rr.com...[color=blue]
    > Hi,
    >
    > I have this JavaScript that is supposed to show random products from my
    > database, and show something different every time you refresh or revisit.
    > But I keep getting an error - on my computer - that says Syntax Error in
    > Line 2.
    >
    > There is no error on most other computers, and the products show, but
    > another script on the page, an article title scroller, stops - on most
    > computers, but not all. It says "no articles available".
    >
    > I've tried the script on an asp page and a htm page, all by itself, but it
    > still doesn't work. I tried changing all kinds of settings in my browsers,
    > but nothing helps. I'm on XP, SP2, which I've heard has some problems
    > handling javascripts. I don't know if that's true, but if it is, I know[/color]
    that[color=blue]
    > lots of other people will have the same problem as me when they view the
    > page. Actually, I think it is a good thing, that my computer is pointing[/color]
    out[color=blue]
    > this error. I get the error message in IE6, but in NS8 and FF, I just[/color]
    don't[color=blue]
    > see the products. No error message.
    >
    > Anyway, here are the first three lines of the script:
    >
    > <%
    > if TRIM(request.se rvervariables(" http_referer")) = "" then
    > %>
    >
    > Using spellcheck, I found that referer is spelled wrong, it should be
    > referrer. I don't know if that is right for javascript (or asp?), but
    > correcting it didn't make a difference.
    >
    > The script is JavaScript on an asp page, and it is called in an htm page.
    >
    > Is the error obvious from the 3 lines?
    >
    > Thanks for any help,
    >
    > JA[/color]

    "http_refer er" is blocked by many firewalls; (e.g. Norton).


    Comment

    • JA

      #3
      Re: Script Error


      I have Zone Alarm, would that do it? Also Norton Anti-Virus.

      What can be done about it? What can it be changed to that wouldn't get
      blocked?

      Thanks, JA


      "McKirahan" <News@McKirahan .com> wrote in message
      news:VeudnZ2dnZ 1kUJq1nZ2dnW_dY d-dnZ2dRVn-zp2dnZ0@comcast .com...[color=blue]
      > "JA" <jarmour@kc.rr. com> wrote in message
      > news:zcXKe.5694 $32.3205@tornad o.rdc-kc.rr.com...[color=green]
      >> Hi,
      >>
      >> I have this JavaScript that is supposed to show random products from my
      >> database, and show something different every time you refresh or revisit.
      >> But I keep getting an error - on my computer - that says Syntax Error in
      >> Line 2.
      >>
      >> There is no error on most other computers, and the products show, but
      >> another script on the page, an article title scroller, stops - on most
      >> computers, but not all. It says "no articles available".
      >>
      >> I've tried the script on an asp page and a htm page, all by itself, but
      >> it
      >> still doesn't work. I tried changing all kinds of settings in my
      >> browsers,
      >> but nothing helps. I'm on XP, SP2, which I've heard has some problems
      >> handling javascripts. I don't know if that's true, but if it is, I know[/color]
      > that[color=green]
      >> lots of other people will have the same problem as me when they view the
      >> page. Actually, I think it is a good thing, that my computer is pointing[/color]
      > out[color=green]
      >> this error. I get the error message in IE6, but in NS8 and FF, I just[/color]
      > don't[color=green]
      >> see the products. No error message.
      >>
      >> Anyway, here are the first three lines of the script:
      >>
      >> <%
      >> if TRIM(request.se rvervariables(" http_referer")) = "" then
      >> %>
      >>
      >> Using spellcheck, I found that referer is spelled wrong, it should be
      >> referrer. I don't know if that is right for javascript (or asp?), but
      >> correcting it didn't make a difference.
      >>
      >> The script is JavaScript on an asp page, and it is called in an htm page.
      >>
      >> Is the error obvious from the 3 lines?
      >>
      >> Thanks for any help,
      >>
      >> JA[/color]
      >
      > "http_refer er" is blocked by many firewalls; (e.g. Norton).
      >
      >[/color]


      Comment

      • David Dorward

        #4
        Re: Script Error

        JA wrote:
        [color=blue]
        > I have this JavaScript that is supposed to show random products from my
        > database, and show something different every time you refresh or revisit.
        > But I keep getting an error - on my computer - that says Syntax Error in
        > Line 2.[/color]
        [color=blue]
        > Anyway, here are the first three lines of the script:[/color]
        [color=blue]
        > <%
        > if TRIM(request.se rvervariables(" http_referer")) = "" then
        > %>[/color]

        This looks like ASP/VBScript, not JavaScript. If your browser is reporting
        an error on line 2, then its line 2 of the output that the browser
        receives, not line 2 of the program that generates the output.
        [color=blue]
        > Using spellcheck, I found that referer is spelled wrong, it should be
        > referrer.[/color]



        The Referer[sic] request-header field allows the client to specify, for
        the server's benefit, the address (URI) of the resource from which the
        Request-URI was obtained (the "referrer", although the header field is
        misspelled.)

        --
        David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
        Home is where the ~/.bashrc is

        Comment

        • McKirahan

          #5
          Re: Script Error

          "JA" <jarmour@kc.rr. com> wrote in message
          news:6KXKe.5697 $32.5547@tornad o.rdc-kc.rr.com...[color=blue]
          >
          > I have Zone Alarm, would that do it? Also Norton Anti-Virus.
          >
          > What can be done about it? What can it be changed to that wouldn't get
          > blocked?
          >
          > Thanks, JA[/color]

          [snip]



          For security reasons, when you post a reply etc, the site checks that you
          have actually come from a page on the forum using what is called a
          HTTP_REFERER. This ensures that database entries can only come from the
          right page, and stops any external scripts (and would-be-if-they-could-be
          hackers)from entering info from souces OTHER than the forum reply page
          itself.

          Unfortunately, some firewall and web filtering software, such as some
          versions of Zone Alarm, block HTTP_REFERER's by default.

          # Disable WebWasher Standard Filter/URL Filter
          # Disable any "ad blocking" software
          # Disable any Pop-up blockers

          ----------------------------------------------------------
          Zone Alarm Pro:

          1. Click Privacy
          2. Click Cookie Control
          3. Click Custom
          4. Uncheck "remove private header information"



          Comment

          • McA

            #6
            Re: Script Error

            > Anyway, here are the first three lines of the script:[color=blue]
            > <%
            > if TRIM(request.se rvervariables(" http_referer")) = "" then
            > %>[/color]

            Use request.serverv ariables("HTTP_ REFERRER")

            BTW this is VBS


            Comment

            • Danny@Kendal

              #7
              Re: Script Error

              "JA" <jarmour@kc.rr. com> wrote in message
              news:zcXKe.5694 $32.3205@tornad o.rdc-kc.rr.com...[color=blue]
              > Hi,
              >
              > I have this JavaScript that is supposed to show random products from my
              > database, and show something different every time you refresh or revisit.
              > But I keep getting an error - on my computer - that says Syntax Error in
              > Line 2.[/color]
              [color=blue]
              > <%
              > if TRIM(request.se rvervariables(" http_referer")) = "" then
              > %>[/color]
              [color=blue]
              > The script is JavaScript on an asp page, and it is called in an htm page.[/color]

              That looks more like vbscript which only works on Internet Explorer and
              servers which allow it.
              Also, don't forget the "end if". You can only omit it when the if/then
              statement is all on one line.

              eg:
              if {condition} then {do something}
              if {condition} then
              {do something else}
              end if

              As for the spelling of "referer", try this link



              Comment

              • McKirahan

                #8
                Re: Script Error

                [snip]
                [color=blue]
                > That looks more like vbscript which only works on Internet Explorer and
                > servers which allow it.[/color]

                [snip]

                "vbscript which only works on Internet Explorer"
                This would be true if it were client-side script.

                ASP runs server-side.


                Comment

                • PDannyD

                  #9
                  Re: Script Error

                  On Friday 12 August 2005 19:05, McKirahan(News@ McKirahan.com) wrote in
                  message <jKSdnVDuL7HceG HfRVn-3Q@comcast.com>
                  [color=blue]
                  > [snip]
                  >[color=green]
                  >> That looks more like vbscript which only works on Internet Explorer and
                  >> servers which allow it.[/color]
                  >
                  > [snip]
                  >
                  > "vbscript which only works on Internet Explorer"
                  > This would be true if it were client-side script.
                  >
                  > ASP runs server-side.[/color]

                  [Danny@Kendal, posting from home]

                  Next you'll be telling me that PHP and MySql are server-side as well. ;-)

                  Comment

                  Working...