"for loop" works in FF but not in IE

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

    "for loop" works in FF but not in IE

    In this for loop, IE skips over the animation function until the end of the
    loop and only aninmates the last phrase. Firefox does it right. Loop is
    right below, entire script is below that. This script uses the Yahoo GUI
    library (beta) for animation.

    for (var c=0; c < index; c++) {
    document.getEle mentById("sampl e").innerTex t = myArray[c];
    var myanim = new YAHOO.util.Anim ('sample', {
    fontSize: {from: 0, to: 50},
    opacity: {from: 0.5, to: 1}
    }, 2);
    myanim.animate( );

    if (c >= myArray.length)
    c=0;
    };
    };


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>test10 </title>
    <script language="JavaS cript" type="text/javascript"
    src="yui/build/yahoo/yahoo.js"></script>
    <script language="JavaS cript" type="text/javascript"
    src="yui/build/dom/dom.js"></script>
    <script language="JavaS cript" type="text/javascript"
    src="yui/build/animation/animation.js"></script>
    <script language="JavaS cript" type="text/javascript"
    src="yui/build/event/event.js"></script>

    <script type="text/javascript">
    var myArray = new Array("note 1","note 2","note 3","note 4","note 5");

    var index = myArray.length;
    var animtest = {};
    animtest.init = function() {
    for (var c=0; c < index; c++) {
    document.getEle mentById("sampl e").innerTex t = myArray[c];
    var myanim = new YAHOO.util.Anim ('sample', {
    fontSize: {from: 0, to: 50},
    opacity: {from: 0.5, to: 1}
    }, 2);
    myanim.animate( );

    if (c >= myArray.length)
    c=0;
    };
    };

    YAHOO.util.Even t.addListener(w indow, 'load', animtest.init);
    </script>
    </head>
    <body>
    <div id="sample"><sp an id="sampletext " style="font-family:Arial, Helvetica,
    sans-serif">SOMETEXT </span></div>
    </body>
    </html>
    --

    Patrick Sullivan, AA-BA, BA-IT

  • Randy Webb

    #2
    Re: &quot;for loop&quot; works in FF but not in IE

    Patrick Sullivan said the following on 6/9/2006 8:55 AM:[color=blue]
    > In this for loop, IE skips over the animation function until the end of the
    > loop and only aninmates the last phrase. Firefox does it right. Loop is
    > right below, entire script is below that. This script uses the Yahoo GUI
    > library (beta) for animation.
    >
    > for (var c=0; c < index; c++) {
    > document.getEle mentById("sampl e").innerTex t = myArray[c];[/color]

    Firefox executes that statement without a syntax error? I ask because FF
    doesn't support innerText in any form unless you create it yourself.

    --
    Randy
    comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

    Comment

    • Tony

      #3
      Re: &quot;for loop&quot; works in FF but not in IE

      Randy Webb wrote:[color=blue]
      > Patrick Sullivan said the following on 6/9/2006 8:55 AM:
      >[color=green]
      >> In this for loop, IE skips over the animation function until the end
      >> of the
      >> loop and only aninmates the last phrase. Firefox does it right. Loop is
      >> right below, entire script is below that. This script uses the Yahoo GUI
      >> library (beta) for animation.
      >>
      >> for (var c=0; c < index; c++) {
      >> document.getEle mentById("sampl e").innerTex t = myArray[c];[/color]
      >
      > Firefox executes that statement without a syntax error? I ask because FF
      > doesn't support innerText in any form unless you create it yourself.[/color]

      Sounds like he's not using the javascript console


      --
      "The most convoluted explanation that fits all the available and made-up
      facts is the most likely to be believed by conspiracy theorists"

      Comment

      • Patrick Sullivan

        #4
        Re: &quot;for loop&quot; works in FF but not in IE

        heheh, firefox did much better than IE. innerText has been incorporated into
        several browsers besides IE. I know it's not standards compliant. I am doing
        it entirely different now, using innerhtml. Also not standards compliant.
        thanks guys.

        --

        Patrick Sullivan, AA-BA, BA-IT

        "Randy Webb" <HikksNotAtHome @aol.com> wrote in message
        news:IvqdncFubK SIMhTZnZ2dnUVZ_ rGdnZ2d@comcast .com...[color=blue]
        > Patrick Sullivan said the following on 6/9/2006 8:55 AM:[color=green]
        > > In this for loop, IE skips over the animation function until the end of[/color][/color]
        the[color=blue][color=green]
        > > loop and only aninmates the last phrase. Firefox does it right. Loop is
        > > right below, entire script is below that. This script uses the Yahoo GUI
        > > library (beta) for animation.
        > >
        > > for (var c=0; c < index; c++) {
        > > document.getEle mentById("sampl e").innerTex t = myArray[c];[/color]
        >
        > Firefox executes that statement without a syntax error? I ask because FF
        > doesn't support innerText in any form unless you create it yourself.
        >
        > --
        > Randy
        > comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
        > Javascript Best Practices -[/color]


        Comment

        Working...