Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I´m constructing a site in "html" languajes. The problem started when I added two optional java script tools to make some images animations (i.e. fading images; data and time, etc...). These java script where added into the main html text in different part of the text. The two java script tools do not work at the same time, only one of them does work. They work independently one each other, but both in the main text of the "html" file get in conflict.
How can I solve this problem???

Kind of hard to determine the problem without anything to look at. THe first thing that comes to mind is that they may both be using a variable of the same name.

Dear Michael J:
These are the three java scripts which are in conflict:
Numbaer 1)
----------<script language="JavaScript1.2" type="text/javascript">
var slideshow_width='300px' //SET IMAGE WIDTH
var slideshow_height='85px' //SET IMAGE HEIGHT
var pause=3000 //SET PAUSE BETWEEN SLIDE (5000=5 seconds)var fadeimages=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
fadeimages[0]="Logo_Firma.jpg"
fadeimages[1]="Logo_EnderecoB.jpg"////NO need to edit beyond here/////////////
var preloadedimages=new Array()
for (p=0;p<fadeimages.length;p++){
preloadedimages[p]=new Image()
preloadedimages[p].src=fadeimages[p]
}var ie4=document.all
var dom=document.getElementByIdif (ie4||dom)
document.write('<div style="position:relative;width:'+slideshow_width+';height:'+slideshow_height+';overflow:hidden"><div id="canvas0" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';top:0;left:0;filter:alpha(opacity=10);-moz-opacity:10"></div><div id="canvas1" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';top:0;left:0;filter:alpha(opacity=10);-moz-opacity:10;visibility: hidden"></div></div>')
else
document.write('')var curpos=10
var degree=10
var curcanvas="canvas0"
var curimageindex=0
var nextimageindex=1
function fadepic(){
if (curpos<100){
curpos+=10
if (tempobj.filters)
tempobj.filters.alpha.opacity=curpos
else if (tempobj.style.MozOpacity)
tempobj.style.MozOpacity=curpos/101
}
else{
clearInterval(dropslide)
nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
tempobj.innerHTML=''
nextimageindex=(nextimageindex<fadeimages.length-1)? nextimageindex+1 : 0
var tempobj2=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
tempobj2.style.visibility="hidden"
setTimeout("rotateimage()",pause)
}
}function rotateimage(){
if (ie4||dom){
resetit(curcanvas)
var crossobj=tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.style.zIndex++
tempobj.style.visibility="visible"
var temp='setInterval("fadepic()",50)'
dropslide=eval(temp)
curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
}
else
document.images.defaultslide.src=fadeimages[curimageindex]
curimageindex=(curimageindex<fadeimages.length-0)? curimageindex+1 : 0
}function resetit(what){
curpos=10
var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
if (crossobj.filters)
crossobj.filters.alpha.opacity=curpos
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=curpos/101
}function startit(){
var crossobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.innerHTML=''
rotateimage()
}if (ie4||dom)
window.onload=startit
else
setInterval("rotateimage()",pause)
</script>---------------
Number 2)
---------<div align="center">
<span id="clock"><SCRIPT LANGUAGE="JavaScript">
</script></span>
</div>
---------------Number 3)
---------<script type="text/javascript">
var ultimateshow=new Array()
//ultimateshow[x]=["path to image"]
ultimateshow[0]=['Portada.jpg', '', '']
ultimateshow[1]=['Portada1.jpg', '', '']
ultimateshow[2]=['Portada2.jpg', '', '']
ultimateshow[3]=['Portada3.jpg', '', '']//configure the below 3 variables to set the dimension/background color of the slideshow
var slidewidth="300px" //set to width of LARGEST image in your slideshow
var slideheight="151px" //set to height of LARGEST iamge in your slideshow
var slidecycles="3" //number of cycles before slideshow stops (ie: "2" or "continous")
var randomorder="no" //randomize the order in which images are displayed? "yes" or "no"
var preloadimages="yes" //preload images? "yes" or "no"
var slidebgcolor='white'//configure the below variable to determine the delay between image rotations (in miliseconds)
var slidedelay=3000////Do not edit pass this line////////////////
var ie=document.all
var dom=document.getElementById
var curcycle=0if (preloadimages=="yes"){
for (i=0;i<ultimateshow.length;i++){
var cacheimage=new Image()
cacheimage.src=ultimateshow[i][0]
}
}var currentslide=0
function randomize(targetarray){
ultimateshowCopy=new Array()
var the_one
var z=0
while (z<targetarray.length){
the_one=Math.floor(Math.random()*targetarray.length)
if (targetarray[the_one]!="_selected!"){
ultimateshowCopy[z]=targetarray[the_one]
targetarray[the_one]="_selected!"
z++
}
}
}if (randomorder=="yes")
randomize(ultimateshow)
else
ultimateshowCopy=ultimateshowfunction rotateimages(){
curcycle=(currentslide==0)? curcycle+1 : curcycle
ultcontainer='<center>'
if (ultimateshowCopy[currentslide][1]!="")
ultcontainer+=''
ultcontainer+=''
if (ultimateshowCopy[currentslide][1]!="")
ultcontainer+=''
ultcontainer+='</center>'
if (ie||dom)
crossrotateobj.innerHTML=ultcontainer
if (currentslide==ultimateshow.length-1) currentslide=0
else currentslide++
if (curcycle==parseInt(slidecycles) && currentslide==0)
return
setTimeout("rotateimages()",slidedelay)
}if (ie||dom)
document.write('<div id="slidedom" style="width:'+slidewidth+';height:'+slideheight+'; background-color:'+slidebgcolor+'"></div>')function start_slider(){
crossrotateobj=dom? document.getElementById("slidedom") : document.all.slidedom
rotateimages()
}if (ie||dom)
window.onload=start_slider</script>
----------------
As appointed before, there work as a separate sheet, but get in conflict when are placed together in the same sheet.
Could you help me please??
Thanks, José.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |