如何实现鼠标经过select的options时,自动取到options的值。 一个select的很多options,需要在鼠标经过这些options时,能够取到Options的值。不是要实现title=""的效果。而是要取到值。多谢。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个超高难度,因为options不响应onmouseover事件 听说用jQuery可以实现。不知道是吗 不光onmouseover不行,就连用键盘的上箭头和下箭头来改变选项。也没法触发onchange事件,必须回车才能触发onchange,到底符合才能在鼠标经过某options或者键盘操作(上下箭头)移动到某options时(无需回车)就能触发一个事件。来取得options的值呢 <!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=utf-8" /><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /><title>无标题文档</title> <script type="text/javascript"> function testSel(event){ var tempDiv = document.getElementById("temp1"); event= window.event||event; // alert(event); var targetEl = event.srcElement||event.target ; //alert(targetEl.tagName) if(targetEl.tagName.toLowerCase()=='option') tempDiv.innerHTML = targetEl.value; } </script></head><body><select id="testSelect" onmousemove="testSel(event)" > <option>1</option> <option>2</option> <option>3</option> <option>4</option></select><div id="temp1" style="border:solid 1px red;"></div></body></html> 你采用div模仿的select吧,真的select不支持 javascript如何可以拖动改变text框大小 求submit+onsubmit+action的组合用法。 EXT+jfreechart能解决的进来看看 谁有梅花雪的tree2.0 模态对话框第一次打开里面的内容是旧的,要再次重新打开,才会变成新内容,请问怎么回事 IE的状态栏怎样显示自己想显示的文字?? 高手帮我——加载进度页面 示两个JS的小程序 底部状态栏 急急急,在线求助:如何读取表格中的数据提交给数据库? jquery的focus和blur事件的兼容性问题? 事件注册 jquery
<!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=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>无标题文档</title>
<script type="text/javascript">
function testSel(event){
var tempDiv = document.getElementById("temp1");
event= window.event||event;
// alert(event);
var targetEl = event.srcElement||event.target ;
//alert(targetEl.tagName)
if(targetEl.tagName.toLowerCase()=='option')
tempDiv.innerHTML = targetEl.value;
}
</script>
</head><body>
<select id="testSelect" onmousemove="testSel(event)" >
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
<div id="temp1" style="border:solid 1px red;"></div>
</body>
</html>