网页图片移动代码
来源:百度知道 编辑:UC知道 时间:2024/05/25 08:56:19
<script>
var ticked=0;
var okayToGo = true;
var currentCreature = 1;
var forwardBackward = 1;
var theNewContainer = 1;
var theOldContainer = 2;
function toggleContainers()
{
theNewContainer = (theNewContainer == 1) ? 2 : 1;
theOldContainer = (theOldContainer == 1) ? 2 : 1;
}
function moveItem(thisCreature){
if(okayToGo&& thisCreature != currentCreature){
toggleContainers();
newCreature = thisCreature;
document.getElementById("y"+theNewContainer).style.zIndex = 50+10*forwardBackward;
document.getElementById("y"+theOldContainer).style.zIndex = 50+20*forwardBackward;
startTheMove = window.setInterval("rightOrLeft()",20);
}
}
function rightOrLeft()