Forum Moderators: open

Message Too Old, No Replies

script not working in IE

works in all other browsers but not in IE...

         

bitstomper

1:43 am on Feb 6, 2007 (gmt 0)

10+ Year Member



I have installed a script that displays images and loads events on mouseover and mouseout and includes a slideshow.

It does not work in IE however and it gives me a type mismatch error on line 84 which is:

zxcp.removeChild(zxcp.getElementsByTagName('DIV')[0]);

The sript is as follows:

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

var MainCenter=455

var zxcTO; 2
var ImgCnt=0;
var zxcEvt=0;

function zxcStyle(zxcele,zxcstyle,zxctxt,zxcp){
if (typeof(zxcele)=='string'){ zxcele=document.createElement(zxcele); }
for (key in zxcstyle){ zxcele.style[key]=zxcstyle[key]; }
if (zxctxt){ zxcele.appendChild(document.createTextNode(zxctxt)); }
if (zxcp){ zxcp.appendChild(zxcele); }
return zxcele;
}

function zxcEventAdd(zxco,zxct,zxcf) {
if ( zxco.addEventListener ){ zxco.addEventListener(zxct, function(e){ zxco[zxcf](e);}, false); }
else if ( zxco.attachEvent ){ zxco.attachEvent('on'+zxct,function(e){ zxco[zxcf](e); }); }
else {
var zxcPrev=zxco["on" + zxct];
if (zxcPrev){ zxco['on'+zxct]=function(e){ zxcPrev(e); zxco[zxcf](e); }; }
else { zxco['on'+zxct]=zxco[zxcf]; }
}
}

function zxcAddEvent(zxc,zxcfun,zxcevt){
if (zxc.addEvent){ return; }
zxc.addEvent=window[zxcfun];
zxcEventAdd(zxc,zxcevt,'addEvent');
}

function zxcAddEvt(zxc,zxcfun,zxcevt){
zxc['zxcaddEvt'+zxcEvt]=window[zxcfun];
zxcEventAdd(zxc,zxcevt,'zxcaddEvt'+zxcEvt);
zxcEvt++;
}

var Path='http://www.marcgerritsen.com/images/'
var ImgAry=[];
ImgAry[0]=['photos/people/tj_yogi.jpg','http://www.marcgerritsen.com','Text 1'];
ImgAry[1]=['photos/people/ken_johnson_artist.jpg','http://www.marcgerritsen.com','Text 1','http://www.marcgerritsen.com','Text 2'];;
ImgAry[2]=['photos/people/luminous_resort_chef.jpg','http://www.marcgerritsen.com','Text 3'];
ImgAry[3]=['photos/people/sharmalee_dancer.jpg','http://www.marcgerritsen.com','Text 4'];
ImgAry[4]=['photos/people/tj_yogi.jpg','http://www.marcgerritsen.com','Text 5'];
ImgAry[5]=['photos/people/space_yoga_team.jpg','http://www.marcgerritsen.com','Text 6'];
ImgAry[6]=['photos/people/waz_porter_musician.jpg','http://www.marcgerritsen.com','Text 7'];
ImgAry[7]=['photos/people/melody_tsai_designer.jpg','http://www.marcgerritsen.com','Text 8'];
ImgAry[8]=['photos/people/naichin_tang_yogi.jpg','http://www.marcgerritsen.com','Text 9'];
ImgAry[9]=['photos/people/sherwood_design_team.jpg','http://www.marcgerritsen.com','Text 10'];
ImgAry[10]=['photos/people/ken_johnson_artist.jpg','http://www.marcgerritsen.com','Text 11'];
ImgAry[11]=['photos/people/luminous_resort_chef.jpg','http://www.marcgerritsen.com','Text 12'];
ImgAry[12]=['photos/people/sharmalee_dancer.jpg','http://www.marcgerritsen.com','Text 13'];
ImgAry[13]=['photos/people/tj_yogi.jpg','http://www.marcgerritsen.com','Text 14'];
ImgAry[14]=['photos/people/space_yoga_team.jpg','http://www.marcgerritsen.com','Text 15'];
ImgAry[15]=['photos/people/waz_porter_musician.jpg','http://www.marcgerritsen.com','Text 16'];
ImgAry[16]=['photos/people/melody_tsai_designer.jpg','http://www.marcgerritsen.com','Text 17'];
ImgAry[17]=['photos/people/naichin_tang_yogi.jpg','http://www.marcgerritsen.com','Text 18'];
ImgAry[18]=['photos/people/sherwood_design_team.jpg','http://www.marcgerritsen.com','Text 19'];
ImgAry[19]=['photos/people/ken_johnson_artist.jpg','http://www.marcgerritsen.com','Text 20'];

for (var zxc0=0;zxc0<ImgAry.length;zxc0++){

ImgAry[zxc0][4]=new Image();
ImgAry[zxc0][4].onload=function(){ }
ImgAry[zxc0][4].src=Path+ImgAry[zxc0][0];
}

function PlaceDots(){
var zxcp=document.getElementById('dots');
zxcp.removeChild(zxcp.getElementsByTagName('DIV')[0]);
var zxclft=0;zxctop=0;
for (var zxc0=0;zxc0<20;zxc0++){
var zxcimg=zxcStyle('IMG',{position:'absolute',left:(zxclft)+'px',top:(zxctop)+'px',cursor:(document.all)?'hand':'pointer'},null,zxcp);
zxcimg.src=Path+'dots/dots'+(zxclft/22+1)+'.gif';
zxcAddEvt(zxcimg,'zxcDotMse','mouseover');
zxcAddEvt(zxcimg,'zxcDotMse','mouseout');
zxclft+=22;
if (zxc0==9){ zxclft=0; zxctop=20; }
}
zxcimg=zxcStyle('IMG',{width:'43px',height:'44px',position:'absolute',left:'220px',top:'-4px'},null,zxcp);
zxcimg.src=Path+'dots/slidedot.gif';
zxcAddEvt(zxcimg,'zxcStartSShow','mouseover');
zxcAddEvt(zxcimg,'zxcStartSShow','mouseout');
zxcStyle(document.getElementById('Main'),{cursor:(document.all)?'hand':'pointer'});
}

function zxcDotMse(zxcevt){
clearTimeout(zxcTO);
var zxcimgout=Path+'dots/dots'+(parseInt(this.style.left)/22+1)+'.gif'
this.src=(zxcevt.type=='mouseover')?Path+'dots/dotred.gif':Path+'dots/dots'+(parseInt(this.style.left)/22+1)+'.gif';
var zxcdotnu=(parseInt(this.style.top)/20*10)+(parseInt(this.style.left)/22);
ImgCnt=zxcdotnu;
PlaceImage();
}

function zxcStartSShow(zxcevt){
zxcevt.cancelBubble=true;
if (zxcevt.stopPropagation) zxcevt.stopPropagation();
clearTimeout(zxcTO);
if (zxcevt.type=='mouseover'){ SlideShow(); }
}

function SlideShow(){
PlaceImage();
ImgCnt=++ImgCnt%ImgAry.length;
zxcTO=setTimeout('SlideShow()',1500);
}

function PlaceImage(){
var zxcimg=document.getElementById('Main')
zxcStyle(zxcimg,{left:(MainCenter-ImgAry[ImgCnt][4].width/2)+'px',top:'250px'});
zxcimg.src=Path+ImgAry[ImgCnt][0];
document.getElementById('text').innerHTML=ImgAry[ImgCnt][2];
}

/*]]>*/
</script>

It is the last problem I need to solve before the site is done so it is very critical and I have not enough experience with Javascript to sort it out myself.
Would appreciate some help with this greatly.

Thanks

bitstomper

2:17 am on Feb 6, 2007 (gmt 0)

10+ Year Member



just discovered that without the second <div> tags the script won't run in Firefox so I placed them back in.

bitstomper

1:32 am on Feb 7, 2007 (gmt 0)

10+ Year Member



I have jsut discovered that it is defintely a conflict between the two sets of scripts: on escript runs the dots placement, rollover states and slideshow while the other set takes care of the navigation at the bottom with the submenus.

This page displays both fine in FF and Safari but not in IE (dots are missing): www.marcgerritsen.com/people.html

This page without the bottom navigation displays the dots in all browsers: www.marcgerritsen.com/people1.html

Please help as this is the last issue before handing the site to my client.

Thanks heaps.

bitstomper

2:14 am on Feb 7, 2007 (gmt 0)

10+ Year Member



Got it solved!

Only needed to call the function from within the <body>
<body onload function> didn't do it.