P
Patrick Sullivan
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>
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>