Hello i am designing a website for my computer class project. I have to sell stuff and on my products page i would like to use this java script more than once. It is a rotating cube that shows different picture of the products. When i do it, i get an error and my teacher says that they are conflicting and that i need to rename all the variables for the second one. I am very new to this and not real good at it. I have not been able to get it to work. I was wondering if someone could help me get this code to work so that i can use it multiple times on a page. Thanks
Heres the code:
<script language="JavaScript1.1">
var specifyimage=new Array() //Your images
specifyimage[0]="12afront.jpg"
specifyimage[1]="12aback12.jpg"
specifyimage[2]="12aback21.jpg"
specifyimage[3]="12aback31.jpg"
var delay=3000 //3 seconds
//Counter for array
var count =1;
var cubeimage=new Array()
for (i=0;i<specifyimage.length;i++){
cubeimage=new Image()
cubeimage.src=specifyimage
}
function movecube(){
if (window.createPopup)
cube.filters[0].apply()
document.images.cube.src=cubeimage[count].src;
if (window.createPopup)
cube.filters[0].play()
count++;
if (count==cubeimage.length)
count=0;
setTimeout("movecube)",delay)
}
window.onload=new Function("setTimeout('movecube()',delay)")
</script>
<img src="12afront.jpg" name="cube" border=0 style="filter😛rogid😀XImageTransform.Microsoft.Stretch(stretchStyle='PUSH')">
Also if you could make the places where i need to make the changes in bold or italics that would help me out alot. Thanks
Steven
Heres the code:
<script language="JavaScript1.1">
var specifyimage=new Array() //Your images
specifyimage[0]="12afront.jpg"
specifyimage[1]="12aback12.jpg"
specifyimage[2]="12aback21.jpg"
specifyimage[3]="12aback31.jpg"
var delay=3000 //3 seconds
//Counter for array
var count =1;
var cubeimage=new Array()
for (i=0;i<specifyimage.length;i++){
cubeimage=new Image()
cubeimage.src=specifyimage
}
function movecube(){
if (window.createPopup)
cube.filters[0].apply()
document.images.cube.src=cubeimage[count].src;
if (window.createPopup)
cube.filters[0].play()
count++;
if (count==cubeimage.length)
count=0;
setTimeout("movecube)",delay)
}
window.onload=new Function("setTimeout('movecube()',delay)")
</script>
<img src="12afront.jpg" name="cube" border=0 style="filter😛rogid😀XImageTransform.Microsoft.Stretch(stretchStyle='PUSH')">
Also if you could make the places where i need to make the changes in bold or italics that would help me out alot. Thanks
Steven