動(dòng)態(tài)菜單
<script language=Jscript>
//用數(shù)組來存儲(chǔ)多個(gè)timeOut標(biāo)識(shí).
tBack=new Array(6);
tOut=new Array(6);
//激活當(dāng)前選項(xiàng)卡.
function menuOut(whichMenu){
var curMenu=eval("menu"+whichMenu);
curMenu.runtimeStyle.zIndex=6;
clearTimeout(tBack[whichMenu]);
moveOut(whichMenu);
}
//恢復(fù)初始狀態(tài).
function menuBack(whichMenu){
var curMenu=eval("menu"+whichMenu);
curMenu.runtimeStyle.zIndex=curMenu.style.zIndex;
clearTimeout(tOut[whichMenu]);
moveBack(whichMenu);
}
//移動(dòng)當(dāng)前選項(xiàng)卡
function moveOut(curNum){
var curMenu=eval("menu"+curNum);
if(curMenu.style.posLeft>0) {
curMenu.style.posLeft-=2;
tOut[curNum]=setTimeout("moveOut('"+curNum+"')",1);
}
}
//移回選項(xiàng)卡.
function moveBack(curNum){
var curMenu=eval("menu"+curNum);
if(curMenu.style.posLeft<30) {
curMenu.style.posLeft+=2;
tBack[curNum]=setTimeout("moveBack('"+curNum+"')",1);
}
}
//鼠標(biāo)移過時(shí)改變表格單元式樣。
function swapClass(){
var o=event.srcElement;
if(o.className=="td1") o.className="td2"
else if(o.className=="td2") o.className="td1";
}
document.onmouseover=swapClass;
document.onmouseout=swapClass;
</script>