如何做到自适应

wtcsy 2009-06-15 03:00:46
希望随着时间的增加 高度越来越小
id为ss的元素高度设置是为100%可是 ie下还是不变化 ff下是正确的
希望改成ie下也能变化的(PS:不能用js算高度然后给ss元素)
<!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=gb2312" />
<title>Dialog</title>
<style type="text/css">
</style>
</head>
<body>
<div id='sss' style=" height:400px;; width:400px; border:1px solid #000000; position:absolute;" onclick="alert('a')">
<div style="height:24px; width:100%; background-color:#006600; position:absolute">11</div>
<div id='ss' style=" height: 100%; width:auto; background-color:#FFFF66"></div>
</div>
<script>
function $(id){return document.getElementById(id)}
//var i =10
//setInterval(function(){$('sss').style.left =i;i=i+10;},100)
var h =400;
timer = setInterval(function(){$('sss').style.height =h+'px';h=h-10;},100)
</script>
</body>
</html>
...全文
26 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
wtcsy 2009-06-16
  • 打赏
  • 举报
回复
梁超兄
这个不叫高度自适应了吧!~
s_liangchao1s 2009-06-15
  • 打赏
  • 举报
回复

<!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=gb2312" />
<title>Dialog</title>
<style type="text/css">
</style>
</head>
<body>
<div id='sss' style=" height:400px;; width:400px; border:1px solid #000000; position:absolute;" onclick="alert('a')">
<div style="height:24px; width:100%; background-color:#006600; position:absolute">11</div>
<div id='ss' style=" height: 100%; width:100%; background-color:#FFFF66"></div>
</div>
<script>
function $(id){return document.getElementById(id)}
var h =400;
timer = setInterval(function(){$('sss').style.height = $('ss').style.height = (h-=10) +'px';},100)
</script>
</body>
</html>

wtcsy 2009-06-15
  • 打赏
  • 举报
回复
当我判断了是ie6时
js能不能操作删除 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
这个?????????????????//
monexus 2009-06-15
  • 打赏
  • 举报
回复
只有在ie7以前的不行
去掉<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
就好了
ahwingwu 2009-06-15
  • 打赏
  • 举报
回复
timer = setInterval(function(){$('sss').style.height =$('ss').style.height =h+'px';h=h-10;},100)

这样不行吗?

87,904

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧