if (!o) return;//為option退出 " /> 蜜桃在线一区二区三区,麻豆精品一区二区,欧美日韩影院

色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

js解決select下拉選不中問題

當事件mouseover中出現select下拉框時,select下拉是選不中的,解決辦法:

var o = e.relatedTarget || e.toElement;//判斷下移動到的對象,移動到option上ie下是null,firefox等為undefined。。
if (!o) return;//為option退出不隱藏

完整代碼案例為:

<!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" /><title>無標題文檔</title><style type="text/css">*{margin:0;padding:0;list-style:none;border:0;}.pop_blue{ position:absolute; cursor:pointer; padding:10px;}.pop_blue span{ display:inline-block; width:24px; height:32px; background: url(../images/pop_blue.png) no-repeat;}.map_xf .rud1{width:210px; position:absolute;border:1px solid #ddd; display:none; background-color:#fff;padding:17px 25px;}.map_xf .rud1 li{margin:0 0 8px;}.map_xf .rud1 input,.map_xf .rud1 select{height:22px;}</style><script type="text/Javascript" src="jquery-1.9.1.min.js"></script><script type="text/Javascript">$(function(){$('.pop_blue').hover(function(){$(this).find('.rud1').show();$(this).css("z-index","9999");},function(e){var o = e.relatedTarget || e.toElement;//判斷下移動到的對象,移動到option上ie下是null,firefox等為undefined。。if (!o) return;//為option退出不隱藏$(this).find('.rud1').hide();$(this).css("z-index","0");})})</script></head><body><div style="position:relative;width:100px;height:100px"><div class="pop_blue" style="top:0px; left:0;"> <span>鼠標移上</span><i></i><div class="rud1 font12" style="top:10px;left:40px; display:none;padding:50px;background:blue;"><ul><li><select class="w100" id="dan"><option value="選擇單元" selected="">選擇單元</option><option value="選擇單元" selected="">選擇單元1</option><option value="選擇單元" selected="">選擇單元2</option><option value="選擇單元" selected="">選擇單元3</option><option value="選擇單元" selected="">選擇單元4</option></select></li></ul></div></div></div></body></html>


當鼠標移上時就不會出現選不中select的情況了。

JavaScript技術js解決select下拉選不中問題,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 蓝山县| 城市| 延吉市| 旬阳县| 巴中市| 深水埗区| 凤山县| 宜昌市| 韶山市| 涟水县| 通辽市| 彩票| 嘉黎县| 汶川县| 印江| 绥芬河市| 新兴县| 彩票| 濮阳县| 津市市| 刚察县| 丹凤县| 正镶白旗| 东乡县| 巴林左旗| 宜兰县| 武定县| 扶风县| 沅江市| 鄂尔多斯市| 确山县| 靖安县| 务川| 临沂市| 佛坪县| 通道| 长汀县| 绵阳市| 荣昌县| 乌拉特后旗| 平乐县|