有个文本input,要随着输入的字符长度而变化宽度。<input type="text" style= "overflow:visible" ></input>在IE中表现良好,可是到firefox就失效了。
查了一下据说是firefox不支持overflow,那请问有什么办法在firefox下实现这个效果么?
有没有其他CSS的或者JAVASCRIPT的写法能让两种浏览器都支持的?
查了一下据说是firefox不支持overflow,那请问有什么办法在firefox下实现这个效果么?
有没有其他CSS的或者JAVASCRIPT的写法能让两种浏览器都支持的?
<!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>
<script>
function aa(obj){
var sSize = obj.getAttribute("size");
var sInputValue = obj.value;
if(sInputValue === "" || sInputValue.length <= sSize || sInputValue.length > 60){
return;
}else{
obj.setAttribute("size",sInputValue.length);
}
}
</script>
</head><body>
<input type="text" id="autoInput" size="25" value="http://" onkeydown="aa(this);" />
</body>
</html>
没找到CSS的写法,用了下脚本。