Kovo88
September 12th, 2007, 10:48 AM
Im trying to get this script to function like it should.
Basically I have two divs that overlap each other. I want it so that everytime one of the divs is clicked on, it comes to the front (so on top of the other one). This can happen anywhere from once to 2000 times (exaggeration).
<script>
function contentMouseDown() {
var topZ = 5;
var dragContent = document.getElementById('windowone');
var dragContent2 = document.getElementById('windowtwo');
if ( ! dragContent.id.match("windowone")) {
dragContent = findParentTagById(dragContent, "windowone");
}
if (dragContent) {
dragContent.style.zIndex = topZ;
dragContent.titlediv.style.zIndex = topZ;
topZ++;
}
if ( ! dragContent2.id.match("windowtwo")) {
dragContent2 = findParentTagById(dragContent2, "windowtwo");
}
if (dragContent2) {
dragContent2.style.zIndex = topZ;
dragContent2.titlediv2.style.zIndex = topZ;
topZ++;
}
}
</script>
For somereason it just does not work. I need a script that increases the zindex by 1 or 5 or wtv every time a div is clicked.
Basically I have two divs that overlap each other. I want it so that everytime one of the divs is clicked on, it comes to the front (so on top of the other one). This can happen anywhere from once to 2000 times (exaggeration).
<script>
function contentMouseDown() {
var topZ = 5;
var dragContent = document.getElementById('windowone');
var dragContent2 = document.getElementById('windowtwo');
if ( ! dragContent.id.match("windowone")) {
dragContent = findParentTagById(dragContent, "windowone");
}
if (dragContent) {
dragContent.style.zIndex = topZ;
dragContent.titlediv.style.zIndex = topZ;
topZ++;
}
if ( ! dragContent2.id.match("windowtwo")) {
dragContent2 = findParentTagById(dragContent2, "windowtwo");
}
if (dragContent2) {
dragContent2.style.zIndex = topZ;
dragContent2.titlediv2.style.zIndex = topZ;
topZ++;
}
}
</script>
For somereason it just does not work. I need a script that increases the zindex by 1 or 5 or wtv every time a div is clicked.