我正在尝试这样做,所以它在每次点击时为z索引添加1,所以它就像101,102,103 ......
st[0].onclick = function () {
var z = 100;
document.getElementById(current).style.display = "block";
document.getElementById(current).style.zIndex = z++;
current = state;
};
答案 0 :(得分:0)
将你的z移到你的功能之外。
var z = 100;
st[0].onclick = function () {
document.getElementById(current).style.display = "block";
document.getElementById(current).style.zIndex = z++;
current = state;
};