Opera shows up bad code?

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

    Opera shows up bad code?

    Hello,

    I have just tried using the latest version of Opera on some code which
    works OK with IE, FF and Safari but there is probably a better way of
    writing the code.

    A sound is played when the play image is clicked and then the user has
    the choice of 2 images to answer a question.

    The code below deals with the first of the 2 images which can be
    clicked to answer the question. The other function is similar.


    function checkThisFirst( what) {

    var x = what.id;
    var first_part_id = x.substring(0,2 );
    result[count] = "first";
    document.getEle mentById('test' +count).classNa me = 'hiddenDiv2';
    // line above - play image made invisible
    document.getEle mentById('test' +count+'1').cla ssName = 'hiddenDiv2';
    // line above - the first and second images made invisible
    if (count<4) {
    document.getEle mentById('test' +(count+1)).cla ssName = 'visibleDiv2';
    / /line above - the next play button made visible
    }

    }

    There are 4 sounds to be played so I need to get

    result[1] to result[4]

    Opera shows up the problem (?) in that the title Test 4 does not
    become invisible after the 4th choice has been made as do Tests 1 to
    Test 3 titles. With IE, FF and Safari Test 4 does become invisible.

    Better way of dealing with the count equals 4 situation?

    Thanks

    Geoff

    PS I hope I have made this clear - if not will post more of the code.
  • Dr J R Stockton

    #2
    Re: Opera shows up bad code?

    In comp.lang.javas cript message <s17224hqkoedj1 83sumpubol27398 hsnrj@4ax.
    com>, Wed, 7 May 2008 04:21:04, Geoff Cox <gcox@freeuk.no tcomposted:
    >
    >I have just tried using the latest version of Opera on some code which
    >works OK with IE, FF and Safari but there is probably a better way of
    >writing the code.
    Latest? Does that mean Version 9.27, or Mini 4, or Opera Mobile, or
    some beta version? I see 9.5 beta is available.

    What does (in 9.27; maybe similar in 9.5) Tools Advanced, Error Console
    show?

    Safari is now 3.1.1.

    --
    (c) John Stockton, nr London UK. ?@merlyn.demon. co.uk Turnpike v6.05 MIME.
    <URL:http://www.merlyn.demo n.co.uk/TP/BP/Delphi/&c., FAQqy topics & links;
    <URL:http://www.merlyn.demo n.co.uk/clpb-faq.txt RAH Prins : c.l.p.b mFAQ;
    <URL:ftp://garbo.uwasa.fi/pc/link/tsfaqp.zipTimo Salmi's Turbo Pascal FAQ.

    Comment

    • Geoff Cox

      #3
      Re: Opera shows up bad code?

      On Wed, 7 May 2008 19:05:28 +0100, Dr J R Stockton
      <jrs@merlyn.dem on.co.ukwrote:
      >In comp.lang.javas cript message <s17224hqkoedj1 83sumpubol27398 hsnrj@4ax.
      >com>, Wed, 7 May 2008 04:21:04, Geoff Cox <gcox@freeuk.no tcomposted:
      >>
      >>I have just tried using the latest version of Opera on some code which
      >>works OK with IE, FF and Safari but there is probably a better way of
      >>writing the code.
      >
      >Latest? Does that mean Version 9.27, or Mini 4, or Opera Mobile, or
      >some beta version? I see 9.5 beta is available.
      >
      >What does (in 9.27; maybe similar in 9.5) Tools Advanced, Error Console
      >show?
      >
      Safari is now 3.1.1.
      Thanks for your reply John,

      It is Opera on my PC, is version 9.27 build 8841.

      I was wrong in saying that the last Title doesn't become invisible, it
      does but is very slow to do so. Also the images may take 3-4 seconds
      to come up and some times when I click on them it takes 3-4 seconds
      for the onClick to happen.

      The error console shows the following - any idea how I check on

      "message: Security error: attempted to read protected variable" or any
      other thoughts?

      Cheers

      Geoff


      JavaScript - http://www.site.com/files/group1/group1-lab1.htm
      Unknown thread
      Error:
      name: ReferenceError
      message: Security error: attempted to read protected variable
      CSS - http://www.site.com/files/group1/group1-lab2.htm
      Inlined stylesheet
      -khtml-opacity is an unknown property
      Line 6:
      -khtml-opacity: 0.40;
      ----------------^
      CSS - http://www.site.com/files/group1/group1-lab2.htm
      Inlined stylesheet
      -moz-opacity is an unknown property
      Line 7:
      -moz-opacity: 0.40;
      --------------------------^
      JavaScript - http://www.site.com/files/group1/group1-lab2.htm
      Unknown thread
      Error:
      name: ReferenceError
      message: Security error: attempted to read protected variable
      JavaScript - http://www.site.com/files/group1/group1-lab3.htm
      Unknown thread
      Error:
      name: ReferenceError
      message: Security error: attempted to read protected variable

      Comment

      • Geoff Cox

        #4
        Re: Opera shows up bad code?

        On Wed, 7 May 2008 19:05:28 +0100, Dr J R Stockton
        <jrs@merlyn.dem on.co.ukwrote:

        John,

        I have just read elsewhere that getting data from a foreign domain is
        a security violation for Javascript - this true? If so then I may have
        a problem as the audio files come form another server - the idea being
        that this would be more robust in the event of losts of users
        accessing the site at the same time.

        Could the foreign domain (www.site.com) explain this Opera error
        message?

        JavaScript - http://www.site.com/files/group1/group1-lab2.htm
        Unknown thread
        Error:
        name: ReferenceError
        message: Security error: attempted to read protected variable
        JavaScript - http://www.site.com/files/group1/group1-lab3.htm
        Unknown thread
        Error:
        name: ReferenceError
        message: Security error: attempted to read protected variable

        Any way round this?

        Cheers

        Geoff

        Comment

        • Geoff Cox

          #5
          Re: Opera shows up bad code?

          On Wed, 7 May 2008 19:05:28 +0100, Dr J R Stockton
          <jrs@merlyn.dem on.co.ukwrote:

          John,

          I have changed so that the audio files are now taken from the same
          server as the rest of the pages but get an error message with Opera

          JavaScript - http://www.mysite.com/files/group1-lab3.htm
          Unknown thread
          Error:
          name: ReferenceError
          message: Security error: attempted to read protected variable

          The images are slow to respond to onClick event.

          Any thought on how I investigate this?!

          Cheers

          Geoff

          Comment

          Working...