BigRob
2012-01-27, 15:58:26
Hi Leute,
ich wollte nur mal fix eine kurze JS-Funktion schreiben. Doch nun verzweifel ich daran. Eigentlich besteht das Problem beim Auslesen des Z-Indexes. Ist eigentlich recht simpel:
function navigation(div1,div2,div3){
var z1 = document.getElementById(div1).style.zIndex;
var z2 = document.getElementById(div2).style.zIndex;
var z3 = document.getElementById(div3).style.zIndex;
var max = 0;
if (z1 < z2)
{
max = z2;
}
if (z2 < z1)
{
max = z1;
}
if (z3 > max)
{
max = z3;
}
max = max+1;
document.getElementById(div1).style.zIndex = max;
document.getElementById(div2).style.zIndex = z2;
document.getElementById(div3).style.zIndex = z3;
}
z1, z2 und z3 bleiben immer 0.
hat jemand eine Idee?
ich wollte nur mal fix eine kurze JS-Funktion schreiben. Doch nun verzweifel ich daran. Eigentlich besteht das Problem beim Auslesen des Z-Indexes. Ist eigentlich recht simpel:
function navigation(div1,div2,div3){
var z1 = document.getElementById(div1).style.zIndex;
var z2 = document.getElementById(div2).style.zIndex;
var z3 = document.getElementById(div3).style.zIndex;
var max = 0;
if (z1 < z2)
{
max = z2;
}
if (z2 < z1)
{
max = z1;
}
if (z3 > max)
{
max = z3;
}
max = max+1;
document.getElementById(div1).style.zIndex = max;
document.getElementById(div2).style.zIndex = z2;
document.getElementById(div3).style.zIndex = z3;
}
z1, z2 und z3 bleiben immer 0.
hat jemand eine Idee?