I’m trying to modify Microsoft's DXImageTransform.Fade() code from having to use a toggle button to loading it on startup and having it loop continuously.
I'll be honest; I do not really know JavaScript that well so I really don't know where to begin.
Here is the code MS provides:
I have tried:
Repeat() {
setTimeout(doTrans(), 3000);
}
and added Repeat(); to the end of doTrans() but I get a memory overflow error after 3 seconds pointing to the "imgObj.filters[0].apply();" line of doTrans()
Any help would be greatly appreciated.
Thanks,
David
I'll be honest; I do not really know JavaScript that well so I really don't know where to begin.
Here is the code MS provides:
Code:
<SCRIPT>
var startImage ="fruit.gif";
var endImage="mouse.gif";
function doTrans() {
imgObj.filters[0].apply();
if (oImg.src.indexOf(startImage)!=-1) {
oImg.src = endImage;
imgObj.style.backgroundColor = "gold";
imgObjText.innerHTML = "<BR><B>Second Page</B><BR><BR>Using the <B>play</B> method reveals the changes in the SPAN element content." }
else {
oImg.src = startImage;
imgObj.style.backgroundColor = "skyblue";
imgObjText.innerHTML = "<BR><b>First Page</b><BR><BR>Using the <B>apply</B> method prepares this SPAN element for content changes." }
imgObj.filters[0].play();
}
</SCRIPT>
</HEAD>
<BODY>
<SPAN style="FILTER: progid:DXImageTransform.Microsoft.Fade(Overlap=1.00); BACKGROUND-COLOR: skyblue; PADDING-LEFT: 13px; WIDTH: 305px; PADDING-RIGHT: 10px; FONT: 9pt/1.3 verdana; HEIGHT: 150px; COLOR: black" id=imgObj><IMG style="MARGIN: 8px" id=oImg align=left src="fruit.gif">
<DIV id=imgObjText><BR><B>First Page</B><BR><BR>Using the <B>apply</B> method prepares this SPAN element for content changes.</DIV></SPAN><BR><BR>
<BUTTON onclick="doTrans()">Play Transition</BUTTON>
</BODY>
Repeat() {
setTimeout(doTrans(), 3000);
}
and added Repeat(); to the end of doTrans() but I get a memory overflow error after 3 seconds pointing to the "imgObj.filters[0].apply();" line of doTrans()
Any help would be greatly appreciated.
Thanks,
David