加一句overflow就可以了
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="ProgId" content="VisualStudio.HTML">
<meta name="Originator" content="Microsoft Visual Studio .NET 7.1">
<script language="javascript">var flag="1";
function $(namediv)
{
return document.getElementById(namediv)
}
function min()
{
chdivinterval = setInterval(change, 1);
}
function change()
{ if(flag=="1")
{
$("newdiv").style.height=$("newdiv").style.height.replace("px","")-1+"px";
if($("newdiv").style.height=="0px")
{
flag="0";
}
}
if(flag=="0")
{
$("newdiv").style.height=parseInt($("newdiv").style.height.replace("px",""))+1+"px";
if($("newdiv").style.height=="180px")
{
flag="1";
}
}
}
</script>
</head>
<body>
<div>想在外层的DIV的高度在0px-180px之间慢慢变化的同时,让内层的DIV随外层的DIV高度变小而慢慢消失,再随外层的DIV高度变大而慢慢出现,没有实现,请大家帮忙!感谢!</div>
<input type="button" value="开始" onclick="min()" ID="Button1" NAME="Button1" /><br/>
<div id="newdiv" class="div" style="DISPLAY:inline;width:160px;height:180px;POSITION:TOP:20px; BORDER: #000000 1px solid;overflow:hidden">
<div style="DISPLAY:inline;width:160px;height:40px;POSITION:TOP:30px; BORDER: #000000 1px solid;"><div>
</div>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="ProgId" content="VisualStudio.HTML">
<meta name="Originator" content="Microsoft Visual Studio .NET 7.1">
<script language="javascript">var flag="1";
function $(namediv)
{
return document.getElementById(namediv)
}
function min()
{
chdivinterval = setInterval(change, 1);
}
function change()
{ if(flag=="1")
{
$("newdiv").style.height=$("newdiv").style.height.replace("px","")-1+"px";
if($("newdiv").style.height=="0px")
{
flag="0";
}
}
if(flag=="0")
{
$("newdiv").style.height=parseInt($("newdiv").style.height.replace("px",""))+1+"px";
if($("newdiv").style.height=="180px")
{
flag="1";
}
}
}
</script>
</head>
<body>
<div>想在外层的DIV的高度在0px-180px之间慢慢变化的同时,让内层的DIV随外层的DIV高度变小而慢慢消失,再随外层的DIV高度变大而慢慢出现,没有实现,请大家帮忙!感谢!</div>
<input type="button" value="开始" onclick="min()" ID="Button1" NAME="Button1" /><br/>
<div id="newdiv" class="div" style="DISPLAY:inline;width:160px;height:180px;POSITION:TOP:20px; BORDER: #000000 1px solid;overflow:hidden">
<div style="DISPLAY:inline;width:160px;height:40px;POSITION:TOP:30px; BORDER: #000000 1px solid;"><div>
</div>
</body>
</html>
解决方案 »
- 网页播放器,html中使用js为什么得不到MideaPlay的状态属性?
- 怎样使enter键触发textbox改变后指定的一个按钮事件
- 请教:下列方法中用参数传值和直接对象操作有什么不同,直接对象操作就可实现我要的效果,但是用参数传值为什么不行。。
- 表单全部置空
- 简单使用 document.createElement 和 new Option 创建一个列表框时碰到的灵异事件,胆小者慎入!!!
- node.js require
- 如何在父页面控制iframe里面页面的控件???急
- 有没有好的办法?<input type="file" name="file" 。。。
- 怎么获得输入字符!详细内容如下:
- Ext 如何在form中动态循环的生成一组组件
- 求Javascript禁用CTRL+鼠标中建的代码
- 这段javascript代码错哪了?救救我!
这个overflow 其实也经常用,这几天头晕了,不想想问题了.