PDA

View Full Version : HELP! Anybody know why this code doesn't work?


likegluelikecrew
10-11-2005, 07:19 PM
When I try to create a library item with the fade image, I start by copying and pasting Ranjan's code into a blank html page and change it to my images. Then I create a table and cut and paste the rotating image into a table cell. All works fine. But when I add images (from the library) to other table cells, when I preview it in a browser the fade stops working. Can anybody help out? What I eventually want to do is add all the images (including the rotating one) as one big library item so I can drag it onto several pages as a nav bar. Big time thanks...

We Are 138


<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title></title>
<script type="text/javascript">
var Pic=new Array("images/withrequestnav/house.gif","images/withrequestnav/world.gif","images/withrequestnav/mp3.gif", "images/withrequestnav/dvd.gif")
var picUrl=new Array("lifestyles/anywherehouse.asp","lifestyles/anywhereworld.asp","lifestyles/ongo.asp","lifestyles/accessmovies.asp")
var slideShowSpeed = 5000;
var t;
var r;
var f;
var j = 0;
var p = Pic.length;
var preLoad = new Array();
var globalOpacity = 0;
for (i = 0; i < p; i++) {
preLoad[i] = new Image();
preLoad[i].src = Pic[i];
}
function runSlideShow() {
document.images.SlideShow.src = preLoad[j].src;
if(document.getElementById){
ael=document.getElementById('SlideURL');
ael.setAttribute('href',picUrl[j]);
}
setalpha(0,"SlideShow");
r=window.setTimeout("reveal('0')", 100);
j = j + 1;
if (j > (p - 1)) j = 0;
t = window.setTimeout('runSlideShow()', slideShowSpeed);
}
function reveal(opacity) {
if (opacity <= 100 ){
setalpha(opacity,"SlideShow");
opacity += 5;
globalOpacity = opacity;
r = window.setTimeout("reveal("+opacity+")", 100);
}
else {
f=window.setTimeout("fade('100')",1000);
}
}
function fade(opacity) {
if (opacity >= 0 ){
setalpha(opacity,"SlideShow");
opacity -= 5;
globalOpacity = opacity;
r = window.setTimeout("fade("+opacity+")", 50);
}
}
function setalpha(opacity,t) {
var target=document.getElementById(t);
if (document.getElementById ) {
if (target.style.MozOpacity!=null) {
target.style.MozOpacity = (opacity/100) - 0.001; //patrick h. lauke (http://www.splintered.co.uk/) workaround for Mozilla 'flash' bug - I _never_ would have caught that
} else if (target.style.opacity!=null) {
target.style.opacity = opacity/100;
} else if (target.style.filter!=null) {
target.style.filter = "alpha(opacity=" + opacity + ")";
} else if (target.style.KhtmlOpacity!=null) {
target.style.KhtmlOpacity = opacity/100;
}
}
}
window.onload = runSlideShow;
</script>
<link href="file:///C|/Inetpub/wwwroot/main.css" rel="stylesheet" type="text/css">
</head>

<body onLoad="MM_preloadImages('images/productsnav/music_ro.gif','images/productsnav/f_ro.gif','images/productsnav/n_ro.gif','images/productsnav/z_ro.gif','images/productsnav/tera_ro.gif','images/productsnav/movies_ro.gif','images/productsnav/vrq_ro.gif','images/wanttobuynav/sales_ro.gif')">
<table width="100%" border="0" cellspacing="30" cellpadding="0">
<tr>
<td align="center"><!-- #BeginLibraryItem "/Library/productsbox.lbi" -->
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<body onLoad="MM_preloadImages('../images/productsnav/music_ro.gif','../images/productsnav/f_ro.gif','../images/productsnav/n_ro.gif','../images/productsnav/z_ro.gif','../images/productsnav/tera_ro.gif','../images/productsnav/movies_ro.gif','../images/productsnav/vrq_ro.gif')"><table width="20" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>images/productsnav/navtop.gif</td>
</tr>
<tr>
<td>images/productsnav/music.gif (products/audio.asp)</td>
</tr>
<tr>
<td>images/productsnav/f.gif (products/fseries.asp)</td>
</tr>
<tr>
<td>images/productsnav/n.gif (products/nseries.asp)</td>
</tr>
<tr>
<td>images/productsnav/z.gif (products/zseries.asp)</td>
</tr>
<tr>
<td>images/productsnav/tera.gif (products/tera.asp)</td>
</tr>
<tr>
<td>images/productsnav/movies.gif (products/videorequest.asp)</td>
</tr>
<tr>
<td>images/productsnav/vrq.gif (products/videorequest.asp)</td>
</tr>
<tr>
<td>images/productsnav/navbottom.gif</td>
</tr>
</table><!-- #EndLibraryItem --></td>
</tr>
<tr>
<td align="center"><!-- #BeginLibraryItem "/Library/wanttobuybox.lbi" -->
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<body onLoad="MM_preloadImages('../images/wanttobuynav/sales_ro.gif')">
<table width="10" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>images/wanttobuynav/topnav.gif</td>
</tr>
<tr>
<td>images/wanttobuynav/sales.gif (sales@request.com)</td>
</tr>
<tr>
<td>images/wanttobuynav/navbottom.gif</td>
</tr>
</table>
<!-- #EndLibraryItem --></td>
</tr>
<tr>
<td align="center">images/withrequestnav/house.gif (lifestyles/anywherehouse.asp)</td>
</tr>
</table>
</body>
</html>