<select size=3 >
<option id="1">1</option>
<option id="2">2</option>
<option id="3">3</option>
<option id="4">4</option>
<option id="5">5</option>
<option id="6">6</option>
</select>
当我鼠标移上select中的一个option时能不能获取当前option的值呢?那个onchange我知道,我想用onmouseove事件是不是可以做到?
如果不行,有哪个大大能告诉我怎么重写个select啊,从而能达到上述效果呢?
我想了很长时间都没想出来,希望有哪个大大解决下,那个希望在html上做。
滚动条可以用CSS
[code="html"]
<br> function add(){<br> child = document.createElement("div");<br> child2 = document.createElement("div");<br> child.appendChild(document.createTextNode("Here is"));<br> child2.appendChild(document.createTextNode("Here is"));<br> document.getElementById("c").appendChild(child);<br> document.getElementById("d").appendChild(child2);<br> }<br>
这里是你要显示的内容
这里是你要显示的内容
[/code]
以下代码只在firefox chrome等浏览器中有效
因为ie6中没有onmouseover事件,所以用jquery绑定事件也是一样
所以还是用div来模仿select显示比较好
[code="html"]
function showselectValue(e) { if (e.target.id!= 'select') { document.getElementById('test').innerHTML = e.target.value; } } function attachTest() { document.getElementById('select').addEventListener('mouseover',showselectValue,false); }
Something Here
One
Two
Three
Four
[/code]
[code="html"]
function attachTest() { $("#select").bind("mouseover", function(e){ if (e.target.id!= 'select') { document.getElementById('test').innerHTML = e.target.value; } }); }
Something Here
One
Two
Three
Four
[/code]