我已经在 mouseover 和 onmouseout 上实现了这个,如下所示:
<select size="3" onmouseover="this.size=this.options.length;">
这一切都很好,除了我不希望它只在鼠标悬停时,我希望它永远 :) 永远。
提前致谢。
我已经在 mouseover 和 onmouseout 上实现了这个,如下所示:
<select size="3" onmouseover="this.size=this.options.length;">
这一切都很好,除了我不希望它只在鼠标悬停时,我希望它永远 :) 永远。
提前致谢。
<select size="3" onmouseover="this.size=this.length;">
<option>hello world 1</option>
<option>hello world 2</option>
<option>hello world 3</option>
<option>hello world 4</option>
<option>hello world 5</option>
<option>hello world 6</option>
<option>hello world 7</option>
<option>hello world 8</option>
</select>
这对我有用:)
在 DomReady 上更新它。
window.onDomReady = function() {
var a = document.getElementById('yourId');
a.size = a.length;
}