Why would this code work in FF3 but not IE7?

Discussion forum for MOD Writers regarding MOD Development.
Locked
User avatar
PTownBandit
Registered User
Posts: 20
Joined: Mon Jul 30, 2007 5:09 pm
Location: Indiana
Contact:

Why would this code work in FF3 but not IE7?

Post by PTownBandit »

I am including another HTML file in the Overall_Header.html file which has code to display a scrolling banner which is made up of multiple images, with every refresh it randomizes the images.

Here is an example... (this will work in IE by itself, but if I include it in the header it wont)
http://www.maximumdirt.com/forum/styles ... oller.html

Basically I am calling the file like this...

<!-- INCLUDE filename.html -->

In Firefox 3.03 it displays the banners, it scrolls, and it randomizes on refresh. In Internet Explorer 7, it only displays the banner, no scrolling, no randomization.

I have verified that the code in the file I am calling works in both browser versions if I have it on a page all by itself. It only breaks once I include it in the Overall_Header.html file.

Here is the code of the file I am calling.

If anyone could help me out and figure out what is not working in IE7 I would greatly appreciate it.

Code: Select all

<style type="text/css">
/*<![CDATA[*/
#tst2 IMG{
 margin-Left:2px;
 border-Width:0px;
}
/*]]>*/
</style>
<script language="JavaScript" type="text/javascript">
/*<![CDATA[*/
// Continious ScrollerII
// The effect is initialised and controlled by event calls to function
// zxcScroller('h','tst2','start',1,100,200);
// parameter 0 = the mode, for vertical 'v', for horizontal 'h'.                     (string 'v' or 'h');
// parameter 1 = the unique id name of the scroll container.                         (string);
// parameter 2 = start or stop.                                                      (string 'start' or 'stop');
// parameter 3 = to scroll up/left = negative digit or down/right = positive digit.  (digit);
//               may also be used to control the scroll speed.
// parameter 4 = the scroll speed (milli seconds).                                   (digits);
// parameter 5 = the initial delay before scrolling (milli seconds).                 (digits);
// The first call will initialise the effect.
// Subsequent calls may be used control the effect by updating parameters 2, 3 and 4.
// If parameters 2 or 3 are not specified the parameter will be toggled.
function zxcScroller(zxcmde,zxcid,zxcrun,zxcud,zxcspd,zxcsrt){
 var zxcp=document.getElementById(zxcid);
 if (!zxcp[zxcmde+'scroll']) return zxcp[zxcmde+'scroll']= new zxcScrollerOOP(zxcmde,zxcp,zxcrun,zxcud,zxcspd,zxcsrt);
 var zxcoop=zxcp[zxcmde+'scroll']
 clearTimeout(zxcp.to);
 zxcoop.spd=zxcspd||zxcoop.spd;
 zxcoop.ud=zxcud||-zxcoop.ud;
 zxcp[zxcmde+'run']=(zxcrun=='stop'||zxcrun=='start')?zxcrun:(zxcp[zxcmde+'run']=='stop')?'start':'stop';
 if (zxcp[zxcmde+'run']=='start') zxcoop.scroll();
}
function zxcScrollerOOP(zxcmde,zxcp,zxcrun,zxcud,zxcspd,zxcsrt){
 this.p=zxcp;
 var zxcc=this.p.getElementsByTagName('DIV')[0]
 this.vh=(zxcmde.charAt(0).toLowerCase()=='v');
 this.mde=zxcmde;
 this.ary=[];
 this.ary[0]=[zxcc,0];
 var zxcmax=(((this.vh)?this.ary[0][0].offsetHeight:this.ary[0][0].offsetWidth))+((this.vh)?this.p.offsetHeight:this.p.offsetWidth);
 this.wh=(this.mde.charAt(0).toLowerCase()=='v')?this.ary[0][0].offsetHeight:this.ary[0][0].offsetWidth;
 var zxcpos=0;
 while (zxcpos<zxcmax){
  var zxc1=this.ary.length;
  this.ary[zxc1]=[this.ary[0][0].cloneNode(true),zxcpos+=this.wh];
  zxcES(this.ary[zxc1][0],{position:'absolute',left:((this.vh)?0:this.ary[zxc1][1])+'px',top:((this.vh)?this.ary[zxc1][1]:0)+'px'},this.p);
 }
 this.ud=zxcud||-1;
 this.spd=zxcspd||100;
 this.p.to=null;
 this.data=[zxcpos,-this.wh];
 this.p[this.mde+'run']=(zxcrun=='stop'||zxcrun=='start')?zxcrun:'start';
 if (this.p[this.mde+'run']) this.p.to=setTimeout(function(zxcoop){return function(){zxcoop.scroll();}}(this),zxcsrt||500);
}
zxcScrollerOOP.prototype.scroll=function(){
 if (this.p[this.mde+'run']=='start'){
  for (var zxc1=0;zxc1<this.ary.length;zxc1++){
   this.ary[zxc1][1]+=this.ud;
   zxcES(this.ary[zxc1][0],{position:'absolute',left:((this.vh)?0:this.ary[zxc1][1])+'px',top:((this.vh)?this.ary[zxc1][1]:0)+'px'});
   if ((this.ud<0&&this.ary[zxc1][1]<=this.data[1])||(this.ud>0&&this.ary[zxc1][1]>this.data[0])) this.ary[zxc1][1]=this.data[(this.ud<0)?0:1];
  }
 }
 this.p.to=setTimeout(function(zxcoop){return function(){zxcoop.scroll();}}(this),this.spd);
}
function zxcES(zxcele,zxcstyle,zxcp,zxctxt){
 if (typeof(zxcele)=='string'){ zxcele=document.createElement(zxcele); }
 for (key in zxcstyle){ zxcele.style[key]=zxcstyle[key]; }
 if (zxcp){ zxcp.appendChild(zxcele); }
 if (zxctxt){ zxcele.appendChild(document.createTextNode(zxctxt)); }
 return zxcele;
}
/*]]>*/
</script>
<script language="JavaScript" type="text/javascript">
/*<![CDATA[*/
function zxcRandomise(zxcid,zxctag){
 var zxcp=document.getElementById(zxcid).getElementsByTagName('DIV')[0];
 var zxcobjs=zxcp.childNodes;
 for (var zxcary=[],zxclft=0,zxc0=0;zxc0<zxcobjs.length;zxc0++){
  if (zxcobjs[zxc0].nodeName==zxctag){
   zxcary.push(zxcobjs[zxc0]);
   zxclft=zxcobjs[zxc0].offsetLeft+zxcobjs[zxc0].offsetWidth;
  }
 }
 zxcES(zxcp,{width:zxclft+'px'});
 zxcary=zxcary.randomise();
 for (var zxc1=0;zxc1<zxcary.length;zxc1++){
  zxcary[zxc1].parentNode.appendChild(zxcary[zxc1]);
 }
}
Array.prototype.randomise=function(){
 zxccnt=0; zxcta=[];
 while (zxccnt<this.length){
  zxctmp=Math.floor(Math.random()*this.length-1)+1;
  if (!zxcta[zxctmp]){zxcta[zxctmp]=this[zxccnt]; zxccnt++; }
 }
 return zxcta;
}
/*]]>*/
</script></head>
<body onLoad="zxcRandomise('tst2','A');zxcScroller('h','tst2','start',-1,10,200);" >
<div id="tst2" style="position:relative; clear:both; overflow:hidden;width:100%;height:100px;border:solid black 0px;background-Color:272826;"
onmouseout="this.hrun='start';"
onmouseover="this.hrun='stop';"
>
<div style="width:4000px;background-Color:272826;" >
<a href="http://www.maximumdirt.com/click/click.php?id=24" target="_blank"><img src="s../forum/styles/prosilver/template/img/Hollingsworth_SM.jpg" width="190" height="100" /></a>
<a href=""><img src="../forum/styles/prosilver/template/img/IndyPipes_SM.gif" width="190" height="100" /></a>
<a href="http://www.maximumdirt.com/click/click.php?id=42" target="_blank"><img src="../forum/styles/prosilver/template/img/FTZ_SM.jpg" width="190" height="100" /></a>
<a href="http://www.maximumdirt.com/click/click.php?id=48" target="_blank"><img src="../forum/styles/prosilver/template/img/Concept_SM.jpg" width="190" height="100" /></a>
<a href="http://www.maximumdirt.com/click/click.php?id=52" target="_blank"><img src="../forum/styles/prosilver/template/img/RMTrailers_SM.gif" width="190" height="100" /></a>
<a href="http://www.maximumdirt.com/click/click.php?id=53" target="_blank"><img src="../forum/styles/prosilver/template/img/Keizer_SM.jpg" width="190" height="100" /></a>
<a href="http://www.maximumdirt.com/click/click.php?id=54" target="_blank"><img src="../forum/styles/prosilver/template/img/McIntyre_SM.gif" width="190" height="100" /></a>
<a href="http://www.maximumdirt.com/click/click.php?id=58" target="_blank"><img src="../forum/styles/prosilver/template/img/StewartDyno.gif" width="190" height="100" /></a>
<a href="http://www.maximumdirt.com/click/click.php?id=59" target="_blank"><img src="../forum/styles/prosilver/template/img/PMP_SM.gif" width="190" height="100" /></a>
<a href="http://www.maximumdirt.com/click/click.php?id=61" target="_blank"><img src="../forum/styles/prosilver/template/img/Gaerte_SM.gif" width="190" height="100" /></a>
<a href="http://www.maximumdirt.com/click/click.php?id=62" target="_blank"><img src="../forum/styles/prosilver/template/img/Guhl_SM.gif" width="190" height="100" /></a>
<a href="http://www.maximumdirt.com/click/click.php?id=74" target="_blank"><img src="../forum/styles/prosilver/template/img/WrightMotors_SM.gif" width="190" height="100" /></a>
<a href="http://www.maximumdirt.com/click/click.php?id=64" target="_blank"><img src="../forum/styles/prosilver/template/img/Hyper_SM.gif" width="190" height="100" /></a>
<a href="http://www.maximumdirt.com/click/click.php?id=69" target="_blank"><img src="../forum/styles/prosilver/template/img/RCI_SM.gif" width="190" height="100" /></a>
<a href="http://www.maximumdirt.com/click/click.php?id=73" target="_blank"><img src="../forum/styles/prosilver/template/img/BuckeyeBowl_SM.jpg" width="190" height="100" /></a>
<a href="http://www.maximumdirt.com/click/click.php?id=72" target="_blank"><img src="../forum/styles/prosilver/template/img/shoestring_SM.gif" width="190" height="100" /></a>
<a href=""><img src="../forum/styles/prosilver/template/img/dirtkinglogo.gif" width="190" height="100" /></a>
<a href="http://www.maximumdirt.com/click/click.php?id=27" target="_blank"><img src="../forum/styles/prosilver/template/img/RacinWebDesign_SM.jpg" width="190" height="100" /></a>
</div>
</div>

User avatar
CTCNetwork
Former Team Member
Posts: 15424
Joined: Fri Dec 19, 2003 3:50 am
Location: In that Volvo behind you!
Contact:

Re: Why would this code work in FF3 but not IE7?

Post by CTCNetwork »

Hi,

I don't think this is a general support question.
Moving to MOD discussion...

Des. . . ;)
Density:- Not just a measurement~Its a whole way of Life.! ! !
| Welcome! | RTFM!!! | Search! It's Easy! | Problem? | Spam? | Advice! |

User avatar
PTownBandit
Registered User
Posts: 20
Joined: Mon Jul 30, 2007 5:09 pm
Location: Indiana
Contact:

Re: Why would this code work in FF3 but not IE7?

Post by PTownBandit »

That's fine, I wondered where to put it, since it has nothing to do with any actual mods and most likely just an error with how the browser interprets the code being included in the header file I decided the support forum.

Locked

Return to “[3.0.x] MOD Writers Discussion”