用css控制select的宽度:(最短100,如果有宽度超过100的选项,将select的宽度调整为最长选项的宽度)<br/>
<select style="width:expression((this.offsetWidth>100)?'auto':'100')">
<option >hellohellohellohellohellohellohellohellohellohello</option></select><br/>
<select style="width:expression((this.offsetWidth>100)?'auto':'100')">
<option ></option></select><br/>
<select style="width:expression((this.offsetWidth>100)?'auto':'100')">
<option >hellohellohellohellohellohellohellohellohellohello</option></select><br/>
<select style="width:expression((this.offsetWidth>100)?'auto':'100')">
<option ></option></select><br/>
解决方案 »
- spring 整合jpa 数据保存不进数据库
- 急求,js报错,找不到对象,大家有没有遇到。
- 请教高手.我把一个网页放在框架中,但是那个网页自动最大化,我本身的网页就没有了
- 判断option重复问题
- 大家好,求一個首頁“跟随屏幕移动的‘近期熱點文章’的代码
- 这里为什么不能用slice(0)代替for循环复制数组????
- 怎样使div内的内容默认的不显示,点击开关后显示??(附代码)
- 请问: document.forms[0].action="getQuestion.do?method=getQuestion";是什么意思啊??
- Js字符串连接问题
- 打印浏览器内容的时候如何去掉页眉页脚?
- 求一试听JS
- 【100分】【求助】document.writeln("")中怎么输出一段"<script>...</script>"
function myclick()
{
if(event.srcElement.id!="mysel")
document.all.mysel.style.width=100;
}
document.onclick=myclick;
</script>
<select id=mysel style="width:100" onmouseover='this.style.width="auto"' onchange='this.style.width=100' onblur='this.style.width=100'>
<option>hello</option>
<option>hellohellohellohellohellohellohellohellohellohello</option></select><input>