Hi,
When I put the first javascript, it works fine. As soon as I put the
second one, the effect stops on both and you can't see any pictures.
This is the script I'm using. {How can I have this effect in 3 areas of
the page?}What area of the script need to be change?
Thank you for your help.
=============== =============== =============== =============== =============== =============== =========
<script language="JavaS cript1.2" type="text/javascript">
var slideshow_width ='140px'
var slideshow_heigh t='225px'
var pause=3000
var fadeimages=new Array()
fadeimages[0]="photo1.jpg "
fadeimages[1]="photo2.jpg "
fadeimages[2]="photo3.jpg "
////NO need to edit beyond here/////////////
var preloadedimages =new Array()
for (p=0;p<fadeimag es.length;p++){
preloadedimages[p]=new Image()
preloadedimages[p].src=fadeimages[p]
}
var ie4=document.al l
var dom=document.ge tElementById
if (ie4||dom)
document.write( '<div
style="position :relative;width :'+slideshow_wi dth+';height:'+ slideshow_heigh t+';overflow:hi dden"><div
id="canvas0"
style="position :absolute;width :'+slideshow_wi dth+';height:'+ slideshow_heigh t+';top:0;left: 0;filter:alpha( opacity=10);-moz-opacity:10"></div><div
id="canvas1"
style="position :absolute;width :'+slideshow_wi dth+';height:'+ slideshow_heigh t+';top:0;left: 0;filter:alpha( opacity=10);-moz-opacity:10;visi bility:
hidden"></div></div>')
else
document.write( '<img name="defaultsl ide" src="'+fadeimag es[0]+'">')
var curpos=10
var degree=10
var curcanvas="canv as0"
var curimageindex=0
var nextimageindex= 1
function fadepic(){
if (curpos<100){
curpos+=10
if (tempobj.filter s)
tempobj.filters .alpha.opacity= curpos
else if (tempobj.style. MozOpacity)
tempobj.style.M ozOpacity=curpo s/101
}
else{
clearInterval(d ropslide)
nextcanvas=(cur canvas=="canvas 0")? "canvas0" : "canvas1"
tempobj=ie4? eval("document. all."+nextcanva s) :
document.getEle mentById(nextca nvas)
tempobj.innerHT ML='<img src="'+fadeimag es[nextimageindex]+'">'
nextimageindex= (nextimageindex <fadeimages.len gth-1)? nextimageindex+ 1 :
0
var tempobj2=ie4? eval("document. all."+nextcanva s) :
document.getEle mentById(nextca nvas)
tempobj2.style. visibility="hid den"
setTimeout("rot ateimage()",pau se)
}
}
function rotateimage(){
if (ie4||dom){
resetit(curcanv as)
var crossobj=tempob j=ie4? eval("document. all."+curcanvas ) :
document.getEle mentById(curcan vas)
crossobj.style. zIndex++
tempobj.style.v isibility="visi ble"
var temp='setInterv al("fadepic()", 50)'
dropslide=eval( temp)
curcanvas=(curc anvas=="canvas0 ")? "canvas1" : "canvas0"
}
else
document.images .defaultslide.s rc=fadeimages[curimageindex]
curimageindex=( curimageindex<f adeimages.lengt h-1)? curimageindex+1 : 0
}
function resetit(what){
curpos=10
var crossobj=ie4? eval("document. all."+what) :
document.getEle mentById(what)
if (crossobj.filte rs)
crossobj.filter s.alpha.opacity =curpos
else if (crossobj.style .MozOpacity)
crossobj.style. MozOpacity=curp os/101
}
function startit(){
var crossobj=ie4? eval("document. all."+curcanvas ) :
document.getEle mentById(curcan vas)
crossobj.innerH TML='<img src="'+fadeimag es[curimageindex]+'">'
rotateimage()
}
if (ie4||dom)
window.onload=s tartit
else
setInterval("ro tateimage()",pa use)
</script>
When I put the first javascript, it works fine. As soon as I put the
second one, the effect stops on both and you can't see any pictures.
This is the script I'm using. {How can I have this effect in 3 areas of
the page?}What area of the script need to be change?
Thank you for your help.
=============== =============== =============== =============== =============== =============== =========
<script language="JavaS cript1.2" type="text/javascript">
var slideshow_width ='140px'
var slideshow_heigh t='225px'
var pause=3000
var fadeimages=new Array()
fadeimages[0]="photo1.jpg "
fadeimages[1]="photo2.jpg "
fadeimages[2]="photo3.jpg "
////NO need to edit beyond here/////////////
var preloadedimages =new Array()
for (p=0;p<fadeimag es.length;p++){
preloadedimages[p]=new Image()
preloadedimages[p].src=fadeimages[p]
}
var ie4=document.al l
var dom=document.ge tElementById
if (ie4||dom)
document.write( '<div
style="position :relative;width :'+slideshow_wi dth+';height:'+ slideshow_heigh t+';overflow:hi dden"><div
id="canvas0"
style="position :absolute;width :'+slideshow_wi dth+';height:'+ slideshow_heigh t+';top:0;left: 0;filter:alpha( opacity=10);-moz-opacity:10"></div><div
id="canvas1"
style="position :absolute;width :'+slideshow_wi dth+';height:'+ slideshow_heigh t+';top:0;left: 0;filter:alpha( opacity=10);-moz-opacity:10;visi bility:
hidden"></div></div>')
else
document.write( '<img name="defaultsl ide" src="'+fadeimag es[0]+'">')
var curpos=10
var degree=10
var curcanvas="canv as0"
var curimageindex=0
var nextimageindex= 1
function fadepic(){
if (curpos<100){
curpos+=10
if (tempobj.filter s)
tempobj.filters .alpha.opacity= curpos
else if (tempobj.style. MozOpacity)
tempobj.style.M ozOpacity=curpo s/101
}
else{
clearInterval(d ropslide)
nextcanvas=(cur canvas=="canvas 0")? "canvas0" : "canvas1"
tempobj=ie4? eval("document. all."+nextcanva s) :
document.getEle mentById(nextca nvas)
tempobj.innerHT ML='<img src="'+fadeimag es[nextimageindex]+'">'
nextimageindex= (nextimageindex <fadeimages.len gth-1)? nextimageindex+ 1 :
0
var tempobj2=ie4? eval("document. all."+nextcanva s) :
document.getEle mentById(nextca nvas)
tempobj2.style. visibility="hid den"
setTimeout("rot ateimage()",pau se)
}
}
function rotateimage(){
if (ie4||dom){
resetit(curcanv as)
var crossobj=tempob j=ie4? eval("document. all."+curcanvas ) :
document.getEle mentById(curcan vas)
crossobj.style. zIndex++
tempobj.style.v isibility="visi ble"
var temp='setInterv al("fadepic()", 50)'
dropslide=eval( temp)
curcanvas=(curc anvas=="canvas0 ")? "canvas1" : "canvas0"
}
else
document.images .defaultslide.s rc=fadeimages[curimageindex]
curimageindex=( curimageindex<f adeimages.lengt h-1)? curimageindex+1 : 0
}
function resetit(what){
curpos=10
var crossobj=ie4? eval("document. all."+what) :
document.getEle mentById(what)
if (crossobj.filte rs)
crossobj.filter s.alpha.opacity =curpos
else if (crossobj.style .MozOpacity)
crossobj.style. MozOpacity=curp os/101
}
function startit(){
var crossobj=ie4? eval("document. all."+curcanvas ) :
document.getEle mentById(curcan vas)
crossobj.innerH TML='<img src="'+fadeimag es[curimageindex]+'">'
rotateimage()
}
if (ie4||dom)
window.onload=s tartit
else
setInterval("ro tateimage()",pa use)
</script>
Comment