473,322 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

"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.getElementById("sample").innerText = 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="JavaScript" type="text/javascript"
src="yui/build/yahoo/yahoo.js"></script>
<script language="JavaScript" type="text/javascript"
src="yui/build/dom/dom.js"></script>
<script language="JavaScript" type="text/javascript"
src="yui/build/animation/animation.js"></script>
<script language="JavaScript" 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.getElementById("sample").innerText = 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.Event.addListener(window, 'load', animtest.init);
</script>
</head>
<body>
<div id="sample"><span id="sampletext" style="font-family:Arial, Helvetica,
sans-serif">SOMETEXT</span></div>
</body>
</html>
--

Patrick Sullivan, AA-BA, BA-IT

Jun 9 '06 #1
3 2220
Patrick Sullivan said the following on 6/9/2006 8:55 AM:
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.getElementById("sample").innerText = myArray[c];


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.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 9 '06 #2
Randy Webb wrote:
Patrick Sullivan said the following on 6/9/2006 8:55 AM:
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.getElementById("sample").innerText = myArray[c];


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


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"
Jun 9 '06 #3
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" <Hi************@aol.com> wrote in message
news:Iv******************************@comcast.com. ..
Patrick Sullivan said the following on 6/9/2006 8:55 AM:
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.getElementById("sample").innerText = myArray[c];


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.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices -

http://www.JavascriptToolbox.com/bestpractices/

Jun 9 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: Invalid User | last post by:
While trying to print a none empty list, I accidentaly put an "else" statement with a "for" instead of "if". Here is what I had: if ( len(mylist)> 0) : for x,y in mylist: print x,y else:...
11
by: Wayne Folta | last post by:
Two observations about PEP-315: 1. It's clever, addresses a definite "wart", and is syntactically similar to try/except. But it's syntax seems like an acquired taste to me. 2. It is a very...
15
by: Robin Eidissen | last post by:
What I try to do is to iterate over two variables using template metaprogramming. I've specialized it such that when it reaches the end of a row ot starts on the next and when it reaches the last...
32
by: Toby Newman | last post by:
At the page: http://www.strath.ac.uk/IT/Docs/Ccourse/subsection3_8_3.html#SECTION0008300000000000000 or http://tinyurl.com/4ptzs the author warns: "The for loop is frequently used, usually...
6
by: John Pass | last post by:
What is the difference between a While and Do While/Loop repetition structure. If they is no difference (as it seems) why do both exist?
3
by: Dale | last post by:
Access 2000 I am trying to check the form to be sure that required fields are entered. For each required field (Control) I have set the tag property to "1". I am trying to loop through all...
9
by: haijin.biz | last post by:
why the following program using "char" gives me an infinite loop? If I change char to int, it works fine. #include <iostream> using namespace std; int main(int argc, char** argv) { for(char...
15
by: Steve | last post by:
I am having problems getting values out of an array. The array is set as a global array and values are pushed into it as they are read from a JSON file using a "for loop". When the "for loop" is...
8
by: Ratko | last post by:
Say you have something like this: for item in myList: del item Would this actually delete the item from the list or just decrement the reference counter because the item in myList is not...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.