开发者

The description of the selected option in dropdown works on all the browsers except Firefox; how to fix it?

开发者 https://www.devze.com 2023-03-17 04:12 出处:网络
<html <head> <title>Dropdown tooltip</title> </head> <body style="font-size:10pt;font-family:Verdana;">
<html    
<head>    
    <title>Dropdown tooltip</title>    
</head>    
    
<body style="font-size:10pt;font-family:Verdana;">    
<script language="javascript">    
function showTip(oSel) {    
    var theTip = document.getElementById("spnTip");    
    theTip.style.top = window.event.clientY + 20;    
    theTip.style.left = window.event.clientX;    
    theTip.innerText = oSel.options[oSel.selectedInd开发者_如何学运维ex].text;    
    theTip.style.visibility = "visible";    
    }
        
function hideTip() {    
    document.getElementById("spnTip").style.visibility = "hidden";    
    }    
</script>

<form>    
<select style="width:100px;" onchange="showTip(this)">    
<option>Have you seen the latest M. Night Shyamalan film?</option>    
<option>It's called The Village.</option>    
<option>Although the critics didn't like it, I think it was extremely well done.</option>    
<option>You will be kept in suspense even if you think you have figured out the ending.</option>    
</select>

<span id="spnTip"    
 style="position:absolute;visibility:hidden;background:lightyellow;    
 border:1px solid gray;padding:2px;font-size:8pt;font-family:Verdana;"    
 onMouseOut="hideTip()"></span>    
<br /><br /><br />    
</form>    
</body>    
</html>


The CSS left and top properties take lengths, not numbers. You are missing units.

0

精彩评论

暂无评论...
验证码 换一张
取 消