Javascript implements some simple DIV Control
Script
Var d1, d2, d3, w, h;
Window. onload = function (){
D1 = document. getElementById ('d1 ');
D2 = document. getElementById ('d2 ');
D3 = document. getElementById ('d3 ');
Back ();
W = window. innerWidth;
H = window. innerHeight;
ResizeCheck ();
}
Function resizeCheck (){
If (w! = Window. innerWidth | h! = Window. innerHeight ){
Location. replace (location. href );
Return;
}
SetTimeout ("resizeCheck ()", 1000 );
}
Function back (){
PMoveTo (d1, 200,50 );
PMoveTo (d2, 250,75 );
PMoveTo (d3, 75, 75 );
PZIndex (d1, 1 );
PZIndex (d2, 2 );
PZIndex (d3, 3 );
PBgColor (d1, '#555 ');
PBgColor (d2, '#777 ');
PBgColor (d3, '#999 ');
PTxtColor (d1, '# fff ');
PTxtColor (d2, '# fff ');
PTxtColor (d3, '# fff ');
PShow (d1 );
PShow (d2 );
PShow (d3 );
}
Function color (){
PBgColor (d1, '# f02d2d ');
PBgColor (d2, '# f040d1 ');
PBgColor (d3, '#55afe0 ');
PTxtColor (d1, '# fff ');
PTxtColor (d2, '# fff ');
PTxtColor (d3, '# fff ');
}
Function pMoveTo (d, x, y ){
D. style. pixelLeft = x;
D. style. pixelTop = y;
}
Function pMoveBy (d, dx, dy ){
D. style. pixelLeft + = dx;
D. style. pixelTop + = dy;
}
Function pShow (d ){
D. style. visibility = 'visable ';
}
Function pHide (d ){
D. style. visibility = 'ddd ';
}
Function pSizeTo (d, w, h ){
D. style. pixelWidth = w;
D. style. pixelHeight = h;
}
Function pSizeBy (d, dw, dh ){
D. style. pixelWidth + = dw;
D. style. pixelHeight + = dh;
}
Function pZIndex (d, z ){
D. style. zIndex = z;
}
Function pBgColor (d, c ){
D. style. background = c;
}
Function pTxtColor (d, c ){
D. style. color = c;
}
Script
D1
D2
D2 contains d3
D3
D3 is the child layer of d2