whats wrong here?

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

    whats wrong here?

    can anybody tell me what is wrong here, I got this shockwave test from
    javascript in easy steps but it doesnt open the pages required

    <html>
    <head>
    <script type = "text/javascript">
    if ( (navigator.appN ame == "Microsoft Internet Explorer"
    && navigator.appVe rsion.IndexOf ( "Mac" ) == -1
    && navigator.appVe rsion.IndexOf ( "3.1" ) == -1)
    || navigator.plugi ns && navigator.plugi ns [ "Shockwave Flash" ] )
    || navigator.plugi ns [ "Shockwave Flash 2.0" ] )
    window.location = "index01.ht ml" ;
    else
    window.location = "index.html " ;
    </script>
    </head>
    <body>
    </body>
    </html>

    the index01 has a flash content, the index doesnt

    TIA


  • Evertjan.

    #2
    Re: whats wrong here?

    iz0nlee wrote on 12 jul 2003 in comp.lang.javas cript:
    [color=blue]
    > can anybody tell me what is wrong here, I got this shockwave test from
    > javascript in easy steps but it doesnt open the pages required
    >
    > <html>
    > <head>
    > <script type = "text/javascript">
    > if ( (navigator.appN ame == "Microsoft Internet Explorer"
    > && navigator.appVe rsion.IndexOf ( "Mac" ) == -1
    > && navigator.appVe rsion.IndexOf ( "3.1" ) == -1)
    >|| navigator.plugi ns && navigator.plugi ns [ "Shockwave Flash" ] )
    >|| navigator.plugi ns [ "Shockwave Flash 2.0" ] )[/color]

    4 '(' and 5 ')'
    [color=blue]
    > window.location = "index01.ht ml" ;[/color]

    [I think no ';' here]
    [color=blue]
    > else
    > window.location = "index.html " ;
    > </script>
    > </head>
    > <body>
    > </body>
    > </html>
    >[/color]



    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)

    Comment

    • iz0nlee

      #3
      Re: whats wrong here?

      thanks for the prompt reply,
      I am not quite sure what this means

      4 '(' and 5 ')'

      I tried removing the semicolon from the first url but it didnt work.

      I am running winXP and IE6, if that makes a difference.
      when I click the 'index02.htm' file it just brings that blamk page up
      instead of redirecting to index01.htm as it should.
      thanks again though
      "Evertjan." <exjxw.hannivoo rt@interxnl.net > wrote in message
      news:Xns93B6688 138E9Beejj99@19 4.109.133.29...[color=blue]
      > iz0nlee wrote on 12 jul 2003 in comp.lang.javas cript:
      >[color=green]
      > > can anybody tell me what is wrong here, I got this shockwave test from
      > > javascript in easy steps but it doesnt open the pages required
      > >
      > > <html>
      > > <head>
      > > <script type = "text/javascript">
      > > if ( (navigator.appN ame == "Microsoft Internet Explorer"
      > > && navigator.appVe rsion.IndexOf ( "Mac" ) == -1
      > > && navigator.appVe rsion.IndexOf ( "3.1" ) == -1)
      > >|| navigator.plugi ns && navigator.plugi ns [ "Shockwave Flash" ] )
      > >|| navigator.plugi ns [ "Shockwave Flash 2.0" ] )[/color]
      >
      > 4 '(' and 5 ')'
      >[color=green]
      > > window.location = "index01.ht ml" ;[/color]
      >
      > [I think no ';' here]
      >[color=green]
      > > else
      > > window.location = "index.html " ;
      > > </script>
      > > </head>
      > > <body>
      > > </body>
      > > </html>
      > >[/color]
      >
      >
      >
      > --
      > Evertjan.
      > The Netherlands.
      > (Please change the x'es to dots in my emailaddress)[/color]


      Comment

      • John G Harris

        #4
        Re: whats wrong here?

        In article <Xns93B6688138E 9Beejj99@194.10 9.133.29>, Evertjan.
        <exjxw.hannivoo rt@interxnl.net > writes[color=blue]
        >iz0nlee wrote on 12 jul 2003 in comp.lang.javas cript:[/color]
        <snip>[color=blue][color=green]
        >> window.location = "index01.ht ml" ;[/color]
        >
        >[I think no ';' here][/color]
        <snip>

        The semicolon is perfectly respectable here. Remember that complicated
        statements are built from simpler statements, and that some kinds of
        statement can (must in C, C++, Java) end in a semicolon.

        If a semicolon looks strange think of it as being inside its statement,
        not as separate punctuation outside.

        John
        --
        John Harris
        mailto:john@jgh arris.demon.co. uk

        Comment

        • Evertjan.

          #5
          Re: whats wrong here?

          John G Harris wrote on 12 jul 2003 in comp.lang.javas cript:[color=blue]
          > In article <Xns93B6688138E 9Beejj99@194.10 9.133.29>, Evertjan.
          > <exjxw.hannivoo rt@interxnl.net > writes[color=green]
          >>iz0nlee wrote on 12 jul 2003 in comp.lang.javas cript:[/color]
          > <snip>[color=green][color=darkred]
          >>> window.location = "index01.ht ml" ;[/color]
          >>
          >>[I think no ';' here][/color]
          > <snip>
          >
          > The semicolon is perfectly respectable here. Remember that complicated
          > statements are built from simpler statements, and that some kinds of
          > statement can (must in C, C++, Java) end in a semicolon.
          >
          > If a semicolon looks strange think of it as being inside its statement,
          > not as separate punctuation outside.[/color]

          You are right, of cource, John.

          if(condition)
          statementtrue;
          else
          statementfalse;
          statementalways ;

          The problem in my mind was, that without {} only one statement is
          allowed.

          I think it was Pascal syntax that disallowed a ; in that position
          otherwise the "else" was orphaned ?

          --
          Evertjan.
          The Netherlands.
          (Please change the x'es to dots in my emailaddress)

          Comment

          • iz0nlee

            #6
            Re: whats wrong here?

            Thanks to all of you who have commented, I found the errant '(' and script
            is now as below and I've checked it till I'm blue in the face but it still
            only returns its own page and doesnt jump to the 'index01'page as it should
            (I think)

            <html>
            <head>
            <script type = "text/javascript">
            if ( (navigator.appN ame == "Microsoft Internet Explorer"
            && navigator.appVe rsion.IndexOf ( "Mac" ) == -1
            && navigator.appVe rsion.IndexOf ( "3.1" ) == -1)
            ||
            (navigator.plug ins
            && navigator.plugi ns[ "Shockwave Flash" ] )
            ||
            navigator.plugi ns [ "Shockwave Flash 2.0" ] )
            window.location = "index01.ht m";
            else
            window.location = "index.htm" ;
            </script>
            </head>
            <body>
            failed again
            </body>
            </html>

            I'm sure there must be a simple explanation, perhaps its something to do
            with the 'pipe' characters, I'm not sure what they do, but for the time
            being I might just put the flash pages up for now as most people use
            shockwave capable browsers anyway and my site doesnt get hits in the
            millions exactly so it probably wont matter.
            Thanks for all your suggestions and interest
            regards


            Comment

            • Evertjan.

              #7
              Re: whats wrong here?

              iz0nlee wrote on 13 jul 2003 in comp.lang.javas cript:
              [color=blue]
              > Thanks to all of you who have commented, I found the errant '(' and
              > script is now as below and I've checked it till I'm blue in the face
              > but it still only returns its own page and doesnt jump to the
              > 'index01'page as it should (I think)
              >
              > <html>
              > <head>
              > <script type = "text/javascript">
              > if ( (navigator.appN ame == "Microsoft Internet Explorer"
              > && navigator.appVe rsion.IndexOf ( "Mac" ) == -1
              > && navigator.appVe rsion.IndexOf ( "3.1" ) == -1)
              >||
              > (navigator.plug ins
              > && navigator.plugi ns[ "Shockwave Flash" ] )
              >||
              > navigator.plugi ns [ "Shockwave Flash 2.0" ] )
              > window.location = "index01.ht m";
              > else
              > window.location = "index.htm" ;
              > </script>
              > </head>
              > <body>
              > failed again
              > </body>
              > </html>[/color]

              Now start testing by deviding the problem, make three seperate testfiles
              and execute them in the same directory as your present html-file:

              ============ test1.html =============== =====

              <script type = "text/javascript">
              if ( true )
              window.location = "index01.ht m";
              else
              window.location = "index.htm" ;
              </script>

              ============ test2.html =============== =====

              <script type = "text/javascript">
              if ( false )
              window.location = "index01.ht m";
              else
              window.location = "index.htm" ;
              </script>

              ============ test3.html =============== =====

              <script type = "text/javascript">
              result =(navigator.app Name == "Microsoft Internet Explorer"
              && navigator.appVe rsion.IndexOf ( "Mac" ) == -1
              && navigator.appVe rsion.IndexOf ( "3.1" ) == -1)
              ||
              (navigator.plug ins
              && navigator.plugi ns[ "Shockwave Flash" ] )
              ||
              navigator.plugi ns [ "Shockwave Flash 2.0" ] )

              alert(result) // must be true or false
              </script>

              =============== =============== =============== ==

              And let us hear the results.

              --
              Evertjan.
              The Netherlands.
              (Please change the x'es to dots in my emailaddress)

              Comment

              • iz0nlee

                #8
                Re: whats wrong here?

                I did just what you said and found when I put the Netscape part in it
                failed.
                I re wrote it like this and it works though I dont have netscape to test it,
                (nor Mac or win3.1 for that matter)
                I'm happy it works now though and thanks for all your help.
                I'll put the script in the head of index.htm then it should transfer most
                people to index01

                regards
                p.s. I answered this a few minutes ago but sent it 'reply' instead of
                'reply group' by accident. Sorry

                <html>
                <head>
                <script type = "text/javascript">
                if ( navigator.appNa me == "Microsoft Internet Explorer"
                && navigator.appVe rsion.indexOf(" Mac") == -1
                && navigator.appVe rsion.indexOf(" 3.1") == -1
                || navigator.plugi ns ["Shockwave Flash"]
                || navigator.plugi ns ["Shockwave Flash 2.0"]
                )
                window.location = "index01.ht m";
                else
                window.location = "index.htm" ;
                </script>
                </head>
                <body>
                failed again
                </body>
                </html>
                "Evertjan." <exjxw.hannivoo rt@interxnl.net > wrote in message
                news:Xns93B76D9 C3567Ceejj99@19 4.109.133.29...[color=blue]
                > iz0nlee wrote on 13 jul 2003 in comp.lang.javas cript:
                >[color=green]
                > > Thanks to all of you who have commented, I found the errant '(' and
                > > script is now as below and I've checked it till I'm blue in the face
                > > but it still only returns its own page and doesnt jump to the
                > > 'index01'page as it should (I think)
                > >
                > > <html>
                > > <head>
                > > <script type = "text/javascript">
                > > if ( (navigator.appN ame == "Microsoft Internet Explorer"
                > > && navigator.appVe rsion.IndexOf ( "Mac" ) == -1
                > > && navigator.appVe rsion.IndexOf ( "3.1" ) == -1)
                > >||
                > > (navigator.plug ins
                > > && navigator.plugi ns[ "Shockwave Flash" ] )
                > >||
                > > navigator.plugi ns [ "Shockwave Flash 2.0" ] )
                > > window.location = "index01.ht m";
                > > else
                > > window.location = "index.htm" ;
                > > </script>
                > > </head>
                > > <body>
                > > failed again
                > > </body>
                > > </html>[/color]
                >
                > Now start testing by deviding the problem, make three seperate testfiles
                > and execute them in the same directory as your present html-file:
                >
                > ============ test1.html =============== =====
                >
                > <script type = "text/javascript">
                > if ( true )
                > window.location = "index01.ht m";
                > else
                > window.location = "index.htm" ;
                > </script>
                >
                > ============ test2.html =============== =====
                >
                > <script type = "text/javascript">
                > if ( false )
                > window.location = "index01.ht m";
                > else
                > window.location = "index.htm" ;
                > </script>
                >
                > ============ test3.html =============== =====
                >
                > <script type = "text/javascript">
                > result =(navigator.app Name == "Microsoft Internet Explorer"
                > && navigator.appVe rsion.IndexOf ( "Mac" ) == -1
                > && navigator.appVe rsion.IndexOf ( "3.1" ) == -1)
                > ||
                > (navigator.plug ins
                > && navigator.plugi ns[ "Shockwave Flash" ] )
                > ||
                > navigator.plugi ns [ "Shockwave Flash 2.0" ] )
                >
                > alert(result) // must be true or false
                > </script>
                >
                > =============== =============== =============== ==
                >
                > And let us hear the results.
                >
                > --
                > Evertjan.
                > The Netherlands.
                > (Please change the x'es to dots in my emailaddress)[/color]


                Comment

                • Evertjan.

                  #9
                  Re: whats wrong here?

                  iz0nlee wrote on 13 jul 2003 in comp.lang.javas cript:[color=blue]
                  > I'll put the script in the head of index.htm then it
                  > should transfer most people to index01
                  > [........]
                  > else
                  > window.location = "index.htm" ;[/color]

                  The others will keep reloading index.htm again and again ??????????


                  --
                  Evertjan.
                  The Netherlands.
                  (Please change the x'es to dots in my emailaddress)

                  Comment

                  • Evertjan.

                    #10
                    Re: whats wrong here?

                    iz0nlee wrote on 13 jul 2003 in comp.lang.javas cript:[color=blue]
                    > "Evertjan." <exjxw.hannivoo rt@interxnl.net > wrote in message
                    > news:Xns93B7762 EF22C5eejj99@19 4.109.133.29...[color=green]
                    >> iz0nlee wrote on 13 jul 2003 in comp.lang.javas cript:[color=darkred]
                    >> > I'll put the script in the head of index.htm then it
                    >> > should transfer most people to index01
                    >> > [........]
                    >> > else
                    >> > window.location = "index.htm" ;[/color]
                    >>
                    >> The others will keep reloading index.htm again and again ??????????[/color]
                    > oops, didnt think of that, i will put it in a separate file , index, and
                    > call the pages index01 and index02.
                    > thanks for a timely rescue
                    > regards
                    >[/color]

                    Or just delete thes two scriptlines:

                    else
                    window.location = "index.htm" ;



                    --
                    Evertjan.
                    The Netherlands.
                    (Please change the x'es to dots in my emailaddress)

                    Comment

                    Working...