用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/>
解决方案 »
- 在htm页中有一张图片我想用javascript 让它在一组屏幕中的点集移动谁有啊?谢谢
- js obj.document.getElementsByTagName("li");
- 如何判断一个对象是在哪个iframe里面?
- ··········怎么生成1到4之前的随机数呀。解决马上给分
- 一组checkbox,需要选中一个时候,把其它的checkbox不选,不想用radio
- 请问应该如何实现多组图片的连续滚动?
- 摄像头可不可以定时拍照
- 初学jquery,初级问题
- textarea编辑的问题(有一定难度)
- 各位看看这句是否有什么问题???
- 求一试听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>