working in Netsc6 and ie 6 but not in Opera7.21

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Québec

    working in Netsc6 and ie 6 but not in Opera7.21

    Hi,
    I am new to Opera and I am quite surprised. I opened the javascript console:
    nothing.
    Nothing appears except the bargroung image in opera.


    <SCRIPT LANGUAGE="JavaS cript">
    var input = getCookieData(" webJPD");
    var hello = input.substring (0, input.indexOf(" |"))
    var lang = input.substring ( input.indexOf(" |") + 1, input.length)

    if(input){
    if(lang == "francais") {
    document.write( "<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>Heureux de
    vous
    revoir</p><p></p><p>&nbsp;&nbs p;&nbsp;&nbsp;& nbsp;&nbsp;&nbs p;&nbsp;&nbsp;& n
    bsp;&nbsp;&nbsp ;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp ;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp ;
    &nbsp;&nbsp; " + hello + "</p>");
    setTimeout('loc ation.replace(" paintings5.htm" );', 5000)
    }

    if(lang == "english"){
    document.write( "<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>Good to see
    you
    again</p><p></p><p>&nbsp;&nbs p;&nbsp;&nbsp;& nbsp;&nbsp;&nbs p;&nbsp;&nbsp;& nb
    sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &
    nbsp;&nbsp;" + hello + "</p>");
    setTimeout('loc ation.replace(" paintings5.htm" );', 5000)
    }
    }else{
    var texte = '<form name="R"><p>Fir st name:<input type="text" name="T1"
    size="20"></p>'
    texte += '<p>Français:<i nput type="radio" value="V1" name="R1"
    onClick="setCoo kie(document.R. T1.value, \'francais\')"> </p>'
    texte += '<p>English:<in put type="radio" value="V2" name="R1"
    onClick="setCoo kie(document.R. T1.value, \'english\')"></p></form>'
    texte += '<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>Veuillez indiquer
    votre préférence SVP.</p>'
    texte += '<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>Please check for
    your prefered language.</p>'
    texte += '<p>&nbsp;</p><p>Merci - Thank you</p>'
    texte += '<p>&nbsp;</p><p></p>'
    document.writel n(texte);
    }
    </script>


  • Lasse Reichstein Nielsen

    #2
    Re: working in Netsc6 and ie 6 but not in Opera7.21

    "Québec" <jpda@vidn.ca > writes:
    [color=blue]
    > I am new to Opera and I am quite surprised. I opened the javascript console:
    > nothing.
    > Nothing appears except the bargroung image in opera.[/color]

    Then there is probably some error in the logic, not in the code.
    [color=blue]
    > <SCRIPT LANGUAGE="JavaS cript">
    > var input = getCookieData(" webJPD");[/color]

    insert:
    alert([input,typeof input,!!input]);
    and see what it gives.
    If input=="", then the result is
    ,string,false
    That would indeed make nothing happen because of the if(input),
    but it would still work for the substring operations. If it gives
    some other result, but still with "false" at the end, then that
    is why nothing is written.

    Notice that Opera is strict in requireing, e g., correct dates on
    cookies. Your cookie might have been refused because it is invalid. IE
    is much more forgiving (some would say too much). I don't know about
    Mozilla.

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • Québec

      #3
      Re: working in Netsc6 and ie 6 but not in Opera7.21


      "Lasse Reichstein Nielsen" <lrn@hotpop.com > wrote in message
      news:d6bpofp4.f sf@hotpop.com.. .[color=blue]
      > "Québec" <jpda@vidn.ca > writes:
      >[color=green]
      > > I am new to Opera and I am quite surprised. I opened the javascript[/color][/color]
      console:[color=blue][color=green]
      > > nothing.
      > > Nothing appears except the bargroung image in opera.[/color]
      >
      > Then there is probably some error in the logic, not in the code.
      >[color=green]
      > > <SCRIPT LANGUAGE="JavaS cript">
      > > var input = getCookieData(" webJPD");[/color]
      >
      > insert:
      > alert([input,typeof input,!!input]);
      > and see what it gives.
      > If input=="", then the result is
      > ,string,false
      > That would indeed make nothing happen because of the if(input),
      > but it would still work for the substring operations. If it gives
      > some other result, but still with "false" at the end, then that
      > is why nothing is written.
      >
      > Notice that Opera is strict in requireing, e g., correct dates on
      > cookies. Your cookie might have been refused because it is invalid. IE
      > is much more forgiving (some would say too much). I don't know about
      > Mozilla.
      >[/color]


      I took off all the ifs

      Inline script thread
      Error:
      name: ReferenceError
      message: Statement on line 2: Reference to undefined variable: No such
      variable 'getCookieData'
      Backtrace:
      Line 2 of inline#1 script in file://localhost/C:/Documents and
      Settings/Jean Pierre/Desktop/testOpera.html
      var input = getCookieData(" webJPD");


      Comment

      • Québec

        #4
        Re: working in Netsc6 and ie 6 but not in Opera7.21

        I get it.

        FPage has added a head and body tag.


        Comment

        Working...