<script?type="text/javascript">
????????window.onload?=?function?()?{
????????????var?oBtn?=?document.getElementById("btnLogin");
????????????oBtn.onclick?=?function?()?{
????????????????//獲取頁面的寬度和高度
????????????????var?sHeight?=?document.documentElement.scrollHeight;
????????????????var?sWidth?=?document.documentElement.scrollWidth;
????????????????//可視區域的高度和寬度
????????????????//如果說頁面是一個豎向的頁面,那么可視區域的寬度和頁面的寬度是一樣的
????????????????var?wHeight?=?document.documentElement.clientHeight;
var?oMask?=?document.createElement("div");
????????????????oMask.id?=?"mask";
????????????????oMask.style.height?=?sHeight?+?"px";
????????????????oMask.style.width?=?sWidth?+?"px";
????????????????document.body.appendChild(oMask);
????????????????var?oLogin?=?document.createElement("div");
????????????????oLogin.id?=?"login";
????????????????oLogin.innerHTML?=?"<div?class='loginCon'><div?id='div1'></div><div?id='div2'></div><div?id='close'></div></div>"
????????????????document.body.appendChild(oLogin);
????????????????//獲取login的寬度和高度
????????????????var?dHeight?=?oLogin.offsetHeight;
????????????????var?dWidth?=?oLogin.offsetWidth;
????????????????oLogin.style.left(sWidth-dWidth)?/?2?+?"px";
????????????????oLogin.style.top(wHeight-dHeight)?/?2?+?"px";
????????????????//獲取id為close的關閉元素
????????????????var?oClose?=?document.getElementById("close");
????????????????oClose.onclick?=?function?()?{
????????????????????document.body.removeChild(oMask);
????????????????????document.body.removeChild(oLogin);
????????????????}
????????????}
????????}
????</script>