2011-11-04 88 views
0

我試圖讓這個所以加1 zIndex的每點擊所以它像101,102,103 ...加1 zIndex的每點擊

st[0].onclick = function() { 

     var z = 100; 
     document.getElementById(current).style.display = "block"; 
     document.getElementById(current).style.zIndex = z++; 
     current = state; 
    }; 
+0

呃,那是什麼問題? – psynnott

回答

0

移動你的z之外你的功能。

var z = 100; 

st[0].onclick = function() { 
     document.getElementById(current).style.display = "block"; 
     document.getElementById(current).style.zIndex = z++; 
     current = state; 
    }; 
+0

啊......謝謝:) – kamalo