PDA

View Full Version : Script no longer working after upgrade to IE 8



Nightwing308
03-14-2014, 05:40 PM
Hi everyone,

I could use some help from any of the real smart folks here (mainly because I'm a "dunce" where scripts are concerned :confused:).

I have this nice script that I found somewhere a long time ago...no idea where it actually came from. It's called
"Apparition" and what it does is make a select image randomly appear and disappear on a webpage.
Pretty much useless, UNLESS you are (like me) creating "decorative" websites, and your customers love their little
added "special effects".

Now, this script never did work in any browser other than Internet Explorer, BUT (unfortunately) it would seem that
after IE 8 it doesn't work anymore at all. :(
I can't attest to IE 9 or 10 since I went straight from IE 8 to IE 11 when I upgraded from Windows XP.

So here is my question/request...could anyone maybe, just MAYBE find a way to PLEASE get this script working again in the newer
versions of Internet Explorer?
I have posted a page with the script at this link http://www.nightwingsgraphics.com/Apparition/apparition.html
and the script file can be viewed/downloaded here http://www.nightwingsgraphics.com/Apparition/layers.js (http://www.nightwingsgraphics.com/Apparition/layers.js)

The apparition sample page is just a plain page with black background, that has little golden paw-prints appearing and disappearing
on it at random (at least if it's viewed with Internet Explorer 8 or earlier...Chrome, Firefox or other browsers won't show the effect).

Any help I could get on this would be GREATLY appreciated.

Thanks

vwphillips
03-15-2014, 02:11 PM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
<style type="text/css">
/*<![CDATA[*/

BODY {
height:3000px;
}

/*]]>*/
</style></head>

<body>


<script type="text/javascript">
/*<![CDATA[*/

function zxcRandomImage(o){
var src=o.imageSRC,w=o.imageWidth,h=o.imageHeight,n=o.imageCount,mv=o.minInvisibleTime,ms=o.randomInterval
var o=this,i=document.createElement('IMG'),m=document.createElement('DIV'),a,z0=0;
o.ms=typeof(ms)=='number'&&ms>0?ms:2000;
o.mv=typeof(mv)=='number'&&mv>0&&mv<o.ms?mv:o.ms/4;
n=Math.max(typeof(n)=='number'&&n>0?n:1,1);
h=typeof(h)=='number'&&h>0?h:null;
w=typeof(w)=='number'&&w>0?w:null;
m.style.position=i.style.position='fixed';
m.style.right=m.style.bottom=m.style.width=m.style.height='0px';
document.body.appendChild(m);
i.style.zIndex='1001';
i.style.left=i.style.top='-3000px';
i.src=src;
w&&h?i.width=w:null;
w&&h?i.height=h:null;
o.m=m;
o.a=[];
for (;z0<n;z0++){
i=i.cloneNode(false);
document.body.appendChild(i);
a=[i];
a[1]=setTimeout(function(){ o.show(a); },Math.floor(Math.random()*o.ms));
}

}

zxcRandomImage.prototype={

show:function(a){
var o=this,ms=Math.floor(Math.random()*o.ms),mv=Math.floor(Math.random()*o.mv);
clearTimeout(a[2]);
a[0].style.left=Math.floor(Math.random()*(o.m.offsetLeft-a[0].width))+'px';
a[0].style.top=Math.floor(Math.random()*(o.m.offsetTop-a[0].height))+'px';
a[1]=setTimeout(function(){ o.show(a); },ms+mv);
a[2]=setTimeout(function(){ a[0].style.top='-3000px'; },ms-mv);

}
}

new zxcRandomImage({
imageSRC:"http://www.vicsjavascripts.org/StdImages/1.gif",
imageWidth:20,
imageHeight:18,
imageCount:5,
minInvisibleTime:500,
randomInterval:2000
})
/*]]>*/
</script>
</body>

</html>

Nightwing308
03-21-2014, 08:12 PM
AWESOME!!! And it even works in FF, Chrome and Opera where the other one didn't. Thank you soooo very much!