hey, nice script but what if i want to move various /objects/ and put the one i clicked above the rest? well, i have a very simple solution: first of all, add this code right in between of z=firedobj and var tmpheight = z.style.height.split("px"), i think the line should be #86.
* piece of code above *
and this function (i know there are many others, and more professional also, but it worked on IE and Firefox very well too): getElementsByClassName(clase)
* function above *
voila. when you click on any object with the class "drag", that piece of code will get the ids of any objects with the class "drag", and give them a z-index value smaller than the one we clicked on.
______________________ // a sphincter says what?
//THE PIECE OF CODE THAT I WROTE // begin of "my piece of code" var clase_drag = getElementsByClassName('drag'); for(var v=0;v<clase_drag.length;v++){
I've got good news, and I've got bad news:
The universe is merely a figment of my imagination.
Now are you ready for the bad news?
but what if i want to move various /objects/ and put the one i clicked above the rest?
well, i have a very simple solution:
first of all, add this code right in between of z=firedobj and var tmpheight = z.style.height.split("px"), i think the line should be #86.
* piece of code above *
and this function (i know there are many others, and more professional also, but it worked on IE and Firefox very well too): getElementsByClassName(clase)
* function above *
voila.
when you click on any object with the class "drag", that piece of code will get the ids of any objects with the class "drag", and give them a z-index value smaller than the one we clicked on.
______________________
// a sphincter says what?
//THE PIECE OF CODE THAT I WROTE
// begin of "my piece of code"
var clase_drag = getElementsByClassName('drag');
for(var v=0;v<clase_drag.length;v++){
if( z.id == clase_drag[v]){
z.style.zIndex = 10;
}
else{
document.getElementById(clase_drag[v]).style.zIndex = 0;
}
}
// end of "my piece of code".
//THE FUNCTION THAT I WROTE
function getElementsByClassName(clase){
var elementos = document.getElementsByTagName('*');
var listado = new Array();
for(var i=0;i<elementos.length;i++){
if( (elementos[i].id != '') && (elementos[i].className == clase) ){
listado.push(elementos[i].id);
}
}
}
return listado;
}
Regards,
Kumar S
GuyFromChennai.com