js登录窗口怎么实现? 我是菜鸟,请问像http://www.discuz.net/forum.php这个网站上,点击登录,出现出现的登录框始终显示在浏览器正中央,这是怎么实现的,请详解,谢谢!我的意思是弹出的层应该要相对浏览窗口位置固定,而不要是相对页面位置固定。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 伪窗口 通过DIV来做的。如果有兴趣直接去网上找一个去 用div做的关键就是style样式了.正常情况下会有 <div id="phoneDiv" style="position:absolute; z-index:1; top:290px; left:600px; display:none;"> 这貌似是一个DIV啊控制位置那就是控制它的style嘛 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><style>#login{ width:220px; height:100px; background:#999; border:1px solid red; float:left; position:absolute; z-index:1000;}#ok{ float:left; margin-left:60px;}</style></head> <body onload="test()" onresize="test()"> <div id="login" > <label>用户名:</label><input type="text" id="username" /> <label>密码:</label><input type="password" id="password" /> <input type="button" id="ok" value="登录" /> <input type="button" value="重置" /></div></body> </html><script>function test(){ var body_width = document.documentElement.clientWidth; var body_height = document.documentElement.clientHeight; document.getElementById("login").style.left = body_width/2 - 220/2 + "px"; document.getElementById("login").style.top = body_height/2 - 100/2 + "px"; //document.getElementById("login").style.marginTop = body_height/2 -100/2 + "px";}</script> 就是做一个DIV层···默认为隐藏为图片添加点击事件``当点击的时候将DIV显示出来·主要就是这个DIV的z-index属性·数值最大的就显示在最上面 问一个IE内存泄露的问题,也许比较初级,但我真是不理解 img怎样得到cookie 我佛山人 Validator v4.0 怎么能够监视到用户按了IE的回退按钮呢? 创建出来的iframe无法创建他的name属性? 请问怎样关闭多个子窗口中某一个? 求页面装载完成后再执行一个事件的代码。 怎样让iframe的宽度和高度自动适应它里面内容的大小,而不出现滚动条? 这种日期显示效果怎样做?帮帮忙 JSP中进行javaScript参数传递的问题 求类似CSDN论坛左边导航的代码 谁能帮我详解一下,window.open打开新页面时出现的怪现象?
<div id="phoneDiv" style="position:absolute; z-index:1; top:290px; left:600px; display:none;">
控制位置那就是控制它的style嘛
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
#login{
width:220px;
height:100px;
background:#999;
border:1px solid red;
float:left;
position:absolute;
z-index:1000;
}
#ok{
float:left;
margin-left:60px;
}
</style>
</head>
<body onload="test()" onresize="test()">
<div id="login" >
<label>用户名:</label><input type="text" id="username" />
<label>密码:</label><input type="password" id="password" />
<input type="button" id="ok" value="登录" />
<input type="button" value="重置" />
</div>
</body>
</html>
<script>
function test(){
var body_width = document.documentElement.clientWidth;
var body_height = document.documentElement.clientHeight;
document.getElementById("login").style.left = body_width/2 - 220/2 + "px";
document.getElementById("login").style.top = body_height/2 - 100/2 + "px";
//document.getElementById("login").style.marginTop = body_height/2 -100/2 + "px";
}
</script>
为图片添加点击事件``当点击的时候将DIV显示出来·
主要就是这个DIV的z-index属性·数值最大的就显示在最上面