javascript css问题 我的问题是:我用js调用DIV 并做一个判断,有一个Div 它的高度是auto的我会在里面加数据,但是我要用js做一个判断当DIV的高度达到190Px的时候就出现滚动条!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <!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>无标题文档</title><style type="text/css"><!--.box {background:#FFF1F1;border:1px solid #FCB1AE; height:auto}.box1 {height:190px; display:block; overflow-y:scroll}--></style></head><body><div class="box">12<br />12<br />12<br />12<br />12<br />12<br />12<br />12<br />12<br />12<br />12<br />12<br />12</div><div class="box">123</div><script type="text/javascript"><!--function setTarCss(){ var i,objs objs=document.getElementsByTagName("div"); for(i=0;i<objs.length;i++){ if(objs[i].offsetHeight>190){ objs[i].className+=' box1'; } }}window.onload=function(){ setTarCss()}--></script></body></html> 你的方法是可以用!但是不能获取div的ID 的啊 你是把所有的DIV 都改变的了啊 我只要一个 DIV 就可以了我要改的这个比如:我要改的这个的DIV的ID=“tt”;那该怎么办呢? <!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>无标题文档</title><style type="text/css"><!--.box {background:#FFF1F1;border:1px solid #FCB1AE; height:auto}.box1 {height:190px; display:block; overflow-y:scroll}--></style></head><body><div class="box" id="demo">12<br />12<br />12<br />12<br />12<br />12<br />12<br />12<br />12<br />12<br />12<br />12<br />12</div><div class="box">123</div><script type="text/javascript"><!--function setTarCss(){ var i,obj obj=document.getElementById("demo"); if(obj.offsetHeight>190){ obj.className+=' box1'; }}window.onload=function(){ setTarCss()}--></script></body></html> GridView 模板列 问题 装了Office 2007,是不是会有这个提供程序Provider=Microsoft.Ace.Oledb.12.0,我要用oledb连接excel 2007 急急急。。。asp.net 整个站点网页编码问题【100分】 在aspx页面中,Page是不是相当于this? 怎样在子窗体中更新父窗口中的内容(ajax updatepanel) datagrid 中 findcontrol 只有十分了 新手非技术问题 很奇怪,服务器控件有时候自动的丢失事件,有什么方法解决? 怪事呀!今天真怪! 页面间怎么传送数据!急 排序解决方案? 求一或若干Sql防注入函数
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.box {background:#FFF1F1;border:1px solid #FCB1AE; height:auto}
.box1 {height:190px; display:block; overflow-y:scroll}
-->
</style>
</head><body>
<div class="box">12<br />12<br />12<br />12<br />12<br />12<br />12<br />12<br />12<br />12<br />12<br />12<br />12</div>
<div class="box">123</div>
<script type="text/javascript">
<!--
function setTarCss(){
var i,objs
objs=document.getElementsByTagName("div");
for(i=0;i<objs.length;i++){
if(objs[i].offsetHeight>190){
objs[i].className+=' box1';
}
}
}
window.onload=function(){
setTarCss()
}
-->
</script>
</body>
</html>
<!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>无标题文档</title>
<style type="text/css">
<!--
.box {background:#FFF1F1;border:1px solid #FCB1AE; height:auto}
.box1 {height:190px; display:block; overflow-y:scroll}
-->
</style>
</head><body>
<div class="box" id="demo">12<br />12<br />12<br />12<br />12<br />12<br />12<br />12<br />12<br />12<br />12<br />12<br />12</div>
<div class="box">123</div>
<script type="text/javascript">
<!--
function setTarCss(){
var i,obj
obj=document.getElementById("demo");
if(obj.offsetHeight>190){
obj.className+=' box1';
}
}
window.onload=function(){
setTarCss()
}
-->
</script>
</body>
</html>