最近碰到一个很郁闷的问题,就是主窗体进行缩放,子窗体也进行缩放.子窗体会发生多次缩放,甚至N次,造成死循环.
经发现这句有问题.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
但若把它删除,会造成子窗体最右边空出一行.不能铺满子窗体.代码如下.
请高手指点.--Default.aspx<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="WebApplication1Test._Default" %><!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>
<script type="text/javascript">
function Resize()
{
document.getElementById("divLef").style.height=document.body.clientHeight+"px";
document.getElementById("divRigth").style.height=document.body.clientHeight+"px";
document.getElementById("frameConten").style.height=document.body.clientHeight+"px";
document.getElementById("divRigth").style.width =document.body.clientWidth-200+"px";
document.getElementById("frameConten").style.width =document.body.clientWidth-200+"px";
}
</script>
<style type="text/css" >
body
{
margin-top:0;
margin-left:0;
margin-right:0;
margin-bottom:0;
font-family:宋体;
font-size:9;
}
</style>
</head>
<body onload="Resize();" onresize="Resize();">
<form id="form1" runat="server">
<div id="divLef" style="background-color:Silver; width:200px; float:left;">
</div>
<div id="divRigth" style ="background-color:Blue; width:200px; float:right;">
<iframe id="frameConten" name="frameConten" width="200px" style="background-color:Blue; border:0px;" frameborder="0" src="WebForm1.aspx" ></iframe>
</div>
</form>
</body>
</html>
--WebForm1.aspx<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="WebApplication1Test.WebForm1" %><!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">
body
{
margin-top:0;
margin-left:0;
margin-right:0;
margin-bottom:0;
font-family:宋体;
font-size:9;
}
.TableHeader
{
FONT-SIZE: 12px;
height:24px;
width:100%;
Background:#014982;
}
</style>
<script type="text/javascript">
function Resize222()
{
document.getElementById("Conten").style.height=document.body.clientHeight-24+"px";
alert(document.body.clientHeight);
}
</script>
</head>
<body onload="Resize222();" onresize="Resize222();">
<form id="form1" runat="server">
<div id ="header" class ="TableHeader">
</div>
<div id="Conten" style="background-color:red"></div>
</form>
</body>
</html>
经发现这句有问题.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
但若把它删除,会造成子窗体最右边空出一行.不能铺满子窗体.代码如下.
请高手指点.--Default.aspx<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="WebApplication1Test._Default" %><!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>
<script type="text/javascript">
function Resize()
{
document.getElementById("divLef").style.height=document.body.clientHeight+"px";
document.getElementById("divRigth").style.height=document.body.clientHeight+"px";
document.getElementById("frameConten").style.height=document.body.clientHeight+"px";
document.getElementById("divRigth").style.width =document.body.clientWidth-200+"px";
document.getElementById("frameConten").style.width =document.body.clientWidth-200+"px";
}
</script>
<style type="text/css" >
body
{
margin-top:0;
margin-left:0;
margin-right:0;
margin-bottom:0;
font-family:宋体;
font-size:9;
}
</style>
</head>
<body onload="Resize();" onresize="Resize();">
<form id="form1" runat="server">
<div id="divLef" style="background-color:Silver; width:200px; float:left;">
</div>
<div id="divRigth" style ="background-color:Blue; width:200px; float:right;">
<iframe id="frameConten" name="frameConten" width="200px" style="background-color:Blue; border:0px;" frameborder="0" src="WebForm1.aspx" ></iframe>
</div>
</form>
</body>
</html>
--WebForm1.aspx<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="WebApplication1Test.WebForm1" %><!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">
body
{
margin-top:0;
margin-left:0;
margin-right:0;
margin-bottom:0;
font-family:宋体;
font-size:9;
}
.TableHeader
{
FONT-SIZE: 12px;
height:24px;
width:100%;
Background:#014982;
}
</style>
<script type="text/javascript">
function Resize222()
{
document.getElementById("Conten").style.height=document.body.clientHeight-24+"px";
alert(document.body.clientHeight);
}
</script>
</head>
<body onload="Resize222();" onresize="Resize222();">
<form id="form1" runat="server">
<div id ="header" class ="TableHeader">
</div>
<div id="Conten" style="background-color:red"></div>
</form>
</body>
</html>
解决方案 »
- 搜索引擎优化 推荐?
- |zyciis| 一个网站要改为虚拟目录,那里面的路径都要怎么来改呢? 因为罗拉和图片我都是用"/"开头的 谢谢
- 提示未将对象引用设置到对象的实例
- iis5.1使用问题,vs2003安装问题,asp.net系统发布问题,SQL导入问题!(给分100分)
- 关于gridview刷新两次才能显示的问题!
- 数据库问题,请大家指点
- 请教window.showModalDialog的问题?
- 我把文件夹下的图片全都绑定到DataGrid中之后如何删除呢?
- js取最小值
- asp.net如何设计模块,高手给点这方面的思路,一起来讨论一下
- asp.net中系统对象的用法
- asp.net的书籍
不一样才该 一样就不改了
就是 在
function Resize()
{
if(document.getElementById("divLef").style.height!=document.body.clientHeight+"px")
document.getElementById("divLef").style.height=document.body.clientHeight+"px";
if(document.getElementById("divRigth").style.height!=document.body.clientHeight+"px")
document.getElementById("divRigth").style.height=document.body.clientHeight+"px";
if(document.getElementById("frameConten").style.height != document.body.clientHeight+"px")
document.getElementById("frameConten").style.height=document.body.clientHeight+"px";
if(document.getElementById("divRigth").style.width != document.body.clientWidth-200+"px")
document.getElementById("divRigth").style.width =document.body.clientWidth-200+"px";
if(document.getElementById("frameConten").style.width !=document.body.clientWidth-200+"px")
document.getElementById("frameConten").style.width =document.body.clientWidth-200+"px";
}