#textare
{
outline:0;
line-height:20px;
background:transparent;
border :0px;
width:600px;
}
function text_readonly(){
var mc = document.getElementById("textare");
if(mc != null && mc.value.length>0){
mc.rows=mc.scrollHeight/16+2;
}
} <textarea id="textare" style="overflow:hidden; size:auto" readonly="readonly" ><%=text%>//动态调用数据。
</textarea><script type="text/javascript">
text_readonly();</script>
为什么在火狐浏览器 opera浏览器都是正常显示,textarea可以自动调节高度
可是在ie 4 中却不行。但是如果在function text_readonly(){
var mc = document.getElementById("textare");
if(mc != null && mc.value.length>0){
alert(mc.value.length);//加上这一句
mc.rows=mc.scrollHeight/16+2;
}
}
就行了,不知道i6-9行不
还有用什么办法可以让在ie4中不加alert()就可以自动调节高度,求高手指点,能讲出为什么最好
Microsoft Internet Explorer
浏览器版本:
4.0 (compatible; MSIE 6.0; Windows NT 5.1)
代码:
Mozilla
平台:
Win32
Cookies 启用:
true
浏览器的用户代理报头:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)