target.style.height = height; // As short form of:
document.getElementById('someId').style.height=height;
但到目前为止我试过的都没用。以下是html文件:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#E3FBFF" text="#000000" onload="loadImages();">
<script type = "text/javascript">
function loadImages()
{
...Function omitted for brevity...
But it gets to this line:
document.getElementById(d0).style.height = height+10;
}
</script>
<div id=d0></div>
<hr>
<div id=d1></div>
<hr>
<div id=d2></div>
<hr>
<div id=d3></div>
<hr>
</body>
</html>
就这样!
我找到了各种各样的文章
like this one
this one
我突然想到,在我的情况下,我不需要使用div本身。我只需要图像和相关的文字不重叠垂直(或水平)。事实上,当图像加载时,它可能是一个真正的混乱。。。我怎样才能告诉我的div是全宽的,没有其他div的重叠?我试着用一个类,用CSS等等,都忽略了。