director87 Posted September 6, 2007 Share Posted September 6, 2007 I receive no output when I test the page in FireFox, although it works perfectly in IE. (Please ignore the PHP as it works fine in both... i think... ) <ilayer id="l1"> <layer id="l2"> <div id="l1"> <div id="l3" style="position:relative"> </div> </div> </layer> </ilayer> <script language="JavaScript"> var bannerArray = new Array(); var myCount=0; <?php do { ?> bannerArray[<?php echo $array ?>] = "<A HREF=\"www.fgmetals.com/jose/coloboraciones_afull.php?coloborador=<?php echo $row_Recordset2['pk']; ?>\"><IMG SRC=\"../../img/grande/<?php echo $row_Recordset2['imagen']; ?>\" border=\"0\" width=\"195\" height=\"160\"></A>"; <?php $array++; } while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)); ?> bannerRotate(); function bannerRotate() { if(myCount > bannerArray.length-1){myCount=0;} if (document.all){ document.all.l3.innerHTML=bannerArray[myCount]; } else if (document.layers){ document.layers.l1.document.layers.l2.document.open(); document.layers.l1.document.layers.l2.document.write(bannerArray[myCount]); document.layers.l1.document.layers.l2.document.close(); } setTimeout("bannerRotate()", 10000); myCount++; } </script> Any and all help is appreciated. Thanks. Quote Link to comment Share on other sites More sharing options...
xenophobia Posted September 6, 2007 Share Posted September 6, 2007 So you are using the below code to catch the browser: if (document.all) else if (document.layers){ I had tried out this: document.layers on firefox, it is not a element that recognize by ff. So that's why you can't run this code in FF. I had read your code, it seems that you just need the content of an element will change (rotate) in 10sec. Why not you just put and simple <div> tag with an id. <div id="content"></div> later on you just put your content using js like this: document.getElementById("content").innerHTML = bannerArray[myCount]; In whole will look like this: <div id="content"></div> <script language="JavaScript"> var bannerArray = new Array(); var myCount=0; <?php do { ?> bannerArray[<?php echo $array ?>] = "<A HREF=\"www.fgmetals.com/jose/coloboraciones_afull.php?coloborador=<?php echo $row_Recordset2['pk']; ?>\"><IMG SRC=\"../../img/grande/<?php echo $row_Recordset2['imagen']; ?>\" border=\"0\" width=\"195\" height=\"160\"></A>"; <?php $array++; } while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)); ?> bannerRotate(); function bannerRotate() { if(myCount > bannerArray.length-1){myCount=0;} document.getElementById("content").innerHTML = bannerArray[myCount]; setTimeout("bannerRotate()", 10000); myCount++; } </script> This make much more easier. Quote Link to comment Share on other sites More sharing options...
director87 Posted September 8, 2007 Author Share Posted September 8, 2007 Yay... perfect. Thanks a lot! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.