下拉列表中所选选项的描述适用于所有浏览器,除了firefox..how要修复它?

时间:2011-07-05 12:47:56

标签: html javascript-events

<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.selectedIndex].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>

1 个答案:

答案 0 :(得分:0)

CSS lefttop属性需要长度,而不是数字。你缺少单位。