JavaScript仿關機界面_層和布局特效
JavaScript仿關機界面,其實是一個隱藏層、顯示層的應用,用了一個布滿小點的圖片當作背景,你完全可以將圖片更換為某一背景顏色,這樣就完全是一個隱藏層的效果了。<html> <head> <title>JavaScript隱藏層、顯示層仿關機界面</title> <script language="JavaScript"> <!-- function ShowLayer(foreID) { var backgroundIDWidth = document.body.clientWidth; var backgroundIDHeight = document.body.clientHeight; backgroundID.style.width = backgroundIDWidth; backgroundID.style.height = backgroundIDHeight; backgroundID.style.display = "block"; var foreTop = (backgroundIDHeight/2)-(parseInt(foreID.style.height)/2); var foreLeft = (backgroundIDWidth/2)-(parseInt(foreID.style.width)/2); foreID.style.top = foreTop; foreID.style.left = foreLeft; foreID.style.display = "block"; } function HiddenLayer(foreID) { backgroundID.style.display = "none"; foreID.style.display = "none"; } //--> </script> </head> <body> <input type="text" name=""> <input type="text" name=""> <input type="text" name=""> <div id="backgroundID" style="display:none;1122123<img src='http://p1.mb5u.com/texiao/3/20100522231348322.gif' _fcksavedurl='http://p1.mb5u.com/texiao/3/20100522231348322.gif'>2244234background:url('http://p1.mb5u.com/texiao/3/20100522231348322.gif');position:absolute;top:0px;left:0px;"></div> <div id="foreID" style="display:none;background-color:#FFFFE1;position:absolute;top:0px;left:0px;width:500px;height:400px;"><input type="button" value="隱藏層" onclick="javascript:HiddenLayer(foreID);"></div> <input type="button" value="顯示層" onclick="javascript:ShowLayer(foreID);"> </body> </html>