
le 29/12/2005 à 22:19
Redimensionnement d'un élément
Hello !
Bon c'est p'tet passé inaperçu alors je répète :
Quelqu'un sait comment on s'en sert?
@+...
Bon c'est p'tet passé inaperçu alors je répète :
function getElt (eltID) {
if (document.layers) return document.layers[eltID+'C'].document.layers[eltID];
if (document.getElementById) return document.getElementById(eltID);
if (document.all) return document.all[eltID];
if (document[eltID+'C']) return document[eltID+'C'].document[eltID];
alert('Rien ne marche avec ce navigateur');
return false;
}
function hideElt (eltID) {
var myelt = getElt(eltID);
if (myelt.style) myelt = myelt.style;
myelt.display = 'none';
}
function showElt (eltID,disp) {
var myelt = getElt(eltID);
if (myelt.style) myelt = myelt.style;
myelt.display = disp;
}
function isHide (eltID) {
var myelt = getElt(eltID);
if (myelt.style) myelt = myelt.style;
return myelt.display == 'none' ? true : false;
}
function switchElt (eltID,disp) {
if (isHide(eltID)) showElt(eltID,disp);
else hideElt(eltID);
}
function mvElt (eltID,mvX,mvY) {
var myelt = getElt (eltID), noPx = document.childNodes ? 'px' : 0;
if (myelt.style) myelt = myelt.style;
myelt.left = mvX + noPx; myelt.top = mvY + noPx;
}
function chgZIndex (eltID,indx) {
var myelt = getElt(eltID);
if (myelt.style) myelt = myelt.style;
myelt.zIndex = indx;
}
function resizeElt(eltID,newWidth,newHeight) {
var myelt = getElt(eltID), noPx = document.childNodes ? 'px' : 0;
if (myelt.style) myelt = myelt.style;
if (myelt.resizeTo) myelt.resizeTo(newWidth,newHeight);
myelt.width = newWidth + noPx; myelt.pixelWidth = newWidth;
myelt.height = newHeight + noPx; myelt.pixelHeight = newHeight;
}
Quelqu'un sait comment on s'en sert?
@+...