小弟想让页面上的三个div层根据浏览器窗口大小自动调整大小,代码如下,在html中完全正常,一放到aspx文件中就不能执行,浏览器打开后就停止响应,请问各位大侠问题出在哪儿,多谢多谢!!!各位大哥帮帮忙,分不够可以再加!!!谢了!!!!!!
<script>
function scall()
{
document.getElementById("TopDiv1").style.width=document.body.clientWidth-150;
document.getElementById("LeftDiv1").style.height=document.body.clientHeight;
document.getElementById("ConDiv1").style.height=document.body.clientHeight-80;
document.getElementById("ConDiv1").style.width=document.body.clientWidth-150;
}
window.onscroll=scall;
window.onresize=scall;
window.onload=scall;
</script>===============================================================
完整的全部代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="p3-nomang.aspx.cs" Inherits="p3_nomang" %><!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 runat="server">
<title>无标题页</title>
<style type="text/css">
.div
{
position: absolute;
border: 1px solid #9999ff;
background-color: #ffffcc;
font-size:12px;
z-index:1000;
}
</style>
<script>
function scall()
{
document.getElementById("TopDiv1").style.width=document.body.clientWidth;
document.getElementById("LeftDiv1").style.height=document.body.clientHeight;
document.getElementById("ConDiv1").style.height=document.body.clientHeight-12;
document.getElementById("ConDiv1").style.width=document.body.clientWidth-8;
}
window.onscroll=scall;
window.onresize=scall;
window.onload=scall;
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="LeftDiv1" class="div" style="z-index: 101; left: 0px; width: 150px; top: 0px;
height: 100%; ">
</div>
<div id="TopDiv1" class="div" style="z-index: 1; left: 141px;top: -15px;
height: 80px; overflow: hidden; position: relative; text-align: right;">
<asp:Button ID="Button1" runat="server" Text="Button" />
</div>
<div id="ConDiv1" class="div" style="z-index: 101; left: 142px; width: 85%; position: relative; top: -13px;
height: 500px; background-color: #ccffcc; border-right: #99ccff thin inset; border-top: #99ccff thin inset; overflow: scroll; border-left: #99ccff thin inset; border-bottom: #99ccff thin inset;">
</div>
</form>
</body>
</html>
<script>
function scall()
{
document.getElementById("TopDiv1").style.width=document.body.clientWidth-150;
document.getElementById("LeftDiv1").style.height=document.body.clientHeight;
document.getElementById("ConDiv1").style.height=document.body.clientHeight-80;
document.getElementById("ConDiv1").style.width=document.body.clientWidth-150;
}
window.onscroll=scall;
window.onresize=scall;
window.onload=scall;
</script>===============================================================
完整的全部代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="p3-nomang.aspx.cs" Inherits="p3_nomang" %><!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 runat="server">
<title>无标题页</title>
<style type="text/css">
.div
{
position: absolute;
border: 1px solid #9999ff;
background-color: #ffffcc;
font-size:12px;
z-index:1000;
}
</style>
<script>
function scall()
{
document.getElementById("TopDiv1").style.width=document.body.clientWidth;
document.getElementById("LeftDiv1").style.height=document.body.clientHeight;
document.getElementById("ConDiv1").style.height=document.body.clientHeight-12;
document.getElementById("ConDiv1").style.width=document.body.clientWidth-8;
}
window.onscroll=scall;
window.onresize=scall;
window.onload=scall;
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="LeftDiv1" class="div" style="z-index: 101; left: 0px; width: 150px; top: 0px;
height: 100%; ">
</div>
<div id="TopDiv1" class="div" style="z-index: 1; left: 141px;top: -15px;
height: 80px; overflow: hidden; position: relative; text-align: right;">
<asp:Button ID="Button1" runat="server" Text="Button" />
</div>
<div id="ConDiv1" class="div" style="z-index: 101; left: 142px; width: 85%; position: relative; top: -13px;
height: 500px; background-color: #ccffcc; border-right: #99ccff thin inset; border-top: #99ccff thin inset; overflow: scroll; border-left: #99ccff thin inset; border-bottom: #99ccff thin inset;">
</div>
</form>
</body>
</html>
解决方案 »
- 打开生成的EXCEL文件
- 散分了!!在mvc的razor视图下怎么使用xml、xslt 对XML数据进行处理,散分了!!
- asp.net3.5打开别人的项目提示系统找不到什么指定的文件?请各位帮忙看一下.谢谢
- js如何获得生成的checkbox?
- 请赐教???jmail接收附件重名的问题
- 发布网站出错的问题
- Web的菜单有没有什么好的方法作呀?
- 请项目实施经验的高手指教,分不够可增贴
- 用makecert.exe制作的证书总显示"无法将这个证书验证到一个受信用的颁发机构",请问如何解决呢?
- 关于DataSet属性的问题
- ASP.net里javascript LPT前台打印
- 关于利用htmltable动态生成产品循环的问题!兄弟们帮忙一下
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">