缺少对象的问题,大家帮我看看!!!
时间:2010-06-03
来源:互联网
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>弹出层定位</title>
<style>
#CustomerFram{position:absolute;display:none;width:335px; height:211px; background:#fff; top:0; left:0;}
#CustomerFram a{ cursor
ointer; color:#0033CC}
.Fram{ width:335px; height:211px; background:#fff;}
.Fram input{ vertical-align:middle;}
.Fram input.input_box{ height:16px; padding:2px 0; line-height:16px;}
</style>
<script>
var bakObj; //定义一个空的全局变量;
function chooseCustomer(obj){
bakObj = obj; //把此方法传进来的参数即当前所点对象使bakObj初始化;
var CustomerFram = document.getElementById("CustomerFram"); //获取弹出框对象
var hidivmt = obj.offsetTop; //获取当前对象居body顶部的高度
var hidivml = obj.offsetLeft; //获取当前对象居body左部的宽度
var objWidth = obj.offsetWidth; //获取当前对象的实际宽度
var objHeight = obj.offsetHeight; //获取当前对象的实际高度
CustomerFram.style.display ="block";
var aBox = obj;//需要获得位置的对象
do {
aBox = aBox.offsetParent;
hidivml += aBox.offsetLeft;
hidivmt += aBox.offsetTop;
}
while( aBox.tagName != "BODY" );
var cusHeight = CustomerFram.offsetHeight; //获取弹出框的实际高度
var cusWidth = CustomerFram.offsetWidth; //获取弹出框的实宽度
var bodyHeight = document.body.clientHeight;
var bodyWidth = document.body.clientWidth;
CustomerFram.style.left = hidivml-1;
CustomerFram.style.top = hidivmt+objHeight;
if(hidivml+cusWidth>=bodyWidth){
CustomerFram.style.left = hidivml+objWidth-cusWidth+1;
}
if(hidivmt+cusHeight>=bodyHeight-objHeight){
CustomerFram.style.top = hidivmt-cusHeight;
}
}
function setValue(obj){
//alert(obj);
bakObj.innerHTML = obj;
document.getElementById("CustomerFram").style.display = 'none';
}
</script>
<body>
<a target="_blank" onClick="chooseCustomer(this)" style="cursor
ointer">登录</a>
<div id="CustomerFram">
<div class="Fram">
<table style="width:335px;height:45px;">
<tr>
<td align="left" width="260" style="color:#F00;font-weight: bold;text-indent:10px;">用户登录</td>
</tr>
</table>
<table width="300" style="height: 140px;">
<tr>
<td width="20"></td>
<td style="color: rgb(255, 0, 0);" colspan="3"></td>
</tr>
<tr>
<td width="20"></td>
<td align="right">用户名:</td>
<td align="left"><input type="text" name="userNames" class="input_box"></td>
</tr>
<tr>
<td width="20"></td><td align="right">密码:</td>
<td align="left"><input type="password" name="PWs" class="input_box"></td>
</tr>
<tr>
<td width="20"></td>
<td></td>
<td align="left"><input type="checkbox" name="SavePW">记住密码</td>
</tr>
<tr>
<td width="20"></td>
<td></td>
<td align="left"><input type="submit" onclick="chkloginss()" value="登陆"><input type="submit" onClick="document.getElementById('CustomerFram').style.display = 'none';" value="取消"></td>
</tr>
<tr>
<td colspan="3" align="center"><a target="_blank" href="register.php" style="margin-right:30px;">注册新用户</a><a target="_blank" href="sendEmail/pwd.php">找回密码</a></td>
</tr>
</table>
</div>
</div>
<!--登录-->
</body>
</html>
不知道为什么,放到网站上面的时候,总是提示缺少对象,高手帮我看看,小女子多谢了!
具体的地址在http://www.npcka.com/intro1.php?gameid=1615
这是我要做的效果,点击登录之后弹出登录的层
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>弹出层定位</title>
<style>
#CustomerFram{position:absolute;display:none;width:335px; height:211px; background:#fff; top:0; left:0;}
#CustomerFram a{ cursor

.Fram{ width:335px; height:211px; background:#fff;}
.Fram input{ vertical-align:middle;}
.Fram input.input_box{ height:16px; padding:2px 0; line-height:16px;}
</style>
<script>
var bakObj; //定义一个空的全局变量;
function chooseCustomer(obj){
bakObj = obj; //把此方法传进来的参数即当前所点对象使bakObj初始化;
var CustomerFram = document.getElementById("CustomerFram"); //获取弹出框对象
var hidivmt = obj.offsetTop; //获取当前对象居body顶部的高度
var hidivml = obj.offsetLeft; //获取当前对象居body左部的宽度
var objWidth = obj.offsetWidth; //获取当前对象的实际宽度
var objHeight = obj.offsetHeight; //获取当前对象的实际高度
CustomerFram.style.display ="block";
var aBox = obj;//需要获得位置的对象
do {
aBox = aBox.offsetParent;
hidivml += aBox.offsetLeft;
hidivmt += aBox.offsetTop;
}
while( aBox.tagName != "BODY" );
var cusHeight = CustomerFram.offsetHeight; //获取弹出框的实际高度
var cusWidth = CustomerFram.offsetWidth; //获取弹出框的实宽度
var bodyHeight = document.body.clientHeight;
var bodyWidth = document.body.clientWidth;
CustomerFram.style.left = hidivml-1;
CustomerFram.style.top = hidivmt+objHeight;
if(hidivml+cusWidth>=bodyWidth){
CustomerFram.style.left = hidivml+objWidth-cusWidth+1;
}
if(hidivmt+cusHeight>=bodyHeight-objHeight){
CustomerFram.style.top = hidivmt-cusHeight;
}
}
function setValue(obj){
//alert(obj);
bakObj.innerHTML = obj;
document.getElementById("CustomerFram").style.display = 'none';
}
</script>
<body>
<a target="_blank" onClick="chooseCustomer(this)" style="cursor

<div id="CustomerFram">
<div class="Fram">
<table style="width:335px;height:45px;">
<tr>
<td align="left" width="260" style="color:#F00;font-weight: bold;text-indent:10px;">用户登录</td>
</tr>
</table>
<table width="300" style="height: 140px;">
<tr>
<td width="20"></td>
<td style="color: rgb(255, 0, 0);" colspan="3"></td>
</tr>
<tr>
<td width="20"></td>
<td align="right">用户名:</td>
<td align="left"><input type="text" name="userNames" class="input_box"></td>
</tr>
<tr>
<td width="20"></td><td align="right">密码:</td>
<td align="left"><input type="password" name="PWs" class="input_box"></td>
</tr>
<tr>
<td width="20"></td>
<td></td>
<td align="left"><input type="checkbox" name="SavePW">记住密码</td>
</tr>
<tr>
<td width="20"></td>
<td></td>
<td align="left"><input type="submit" onclick="chkloginss()" value="登陆"><input type="submit" onClick="document.getElementById('CustomerFram').style.display = 'none';" value="取消"></td>
</tr>
<tr>
<td colspan="3" align="center"><a target="_blank" href="register.php" style="margin-right:30px;">注册新用户</a><a target="_blank" href="sendEmail/pwd.php">找回密码</a></td>
</tr>
</table>
</div>
</div>
<!--登录-->
</body>
</html>
不知道为什么,放到网站上面的时候,总是提示缺少对象,高手帮我看看,小女子多谢了!
具体的地址在http://www.npcka.com/intro1.php?gameid=1615
这是我要做的效果,点击登录之后弹出登录的层
作者: saraswallow 发布时间: 2010-06-03
在线等,高手来帮我小女子!
作者: saraswallow 发布时间: 2010-06-03
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28