在开发过程中受select标签长度的限制,经常有些内容不能完整的展示。
下面的方式是我常用一种解决方案,但是有一定的局限性。再次抛砖引玉,希望能引来其他更好的方案...
----实现一个冒泡展示的实例
<html>
<head>
<script type="text/javascript">
//冒泡
function mouseclick(obj)
{
with(document.all.div_hint)
{
innerText=obj.options[obj.selectedIndex].text;
if(innerText.length>0)
{
innerText=""+innerText+" ";
style.display="block";
style.left=event.clientX;
style.top=event.clientY+15;
}
}
} function mouseout(obj)
{
with (document.all.div_hint)
style.display="none";
}
</script>
</head>
<body>
<form id="queryForm" method="post">
<table id="layerOne" cellspacing="0" cellpadding="0" width="98%" border="0"
align="center" cssclass="table_listoutline">
<select name="name" onmouseover="mouseclick(this)" onmouseout="mouseout(this);" />
</table>
</form>
</body>
<iframe id="myframe" frameborder="0"
style="position:absolute;
width:expression(this.nextSibling.offsetWidth);
height:expression(this.nextSibling.offsetHeight);
top:expression(this.nextSibling.offsetTop);
left:expression(this.nextSibling.offsetLeft);
border="0" scrolling="no">
</iframe>
<div id=div_hint
style="font-size:12px;color:black;display:none;position:absolute;zIndex:10;top:200;
background-color:#FCFDCC;layer-background-color:#0099FF;border:1 #9c9c9c
solid;filter:alpha(style=0,opacity=80,finishOpacity=100);">
</div>
</html>
下面的方式是我常用一种解决方案,但是有一定的局限性。再次抛砖引玉,希望能引来其他更好的方案...
----实现一个冒泡展示的实例
<html>
<head>
<script type="text/javascript">
//冒泡
function mouseclick(obj)
{
with(document.all.div_hint)
{
innerText=obj.options[obj.selectedIndex].text;
if(innerText.length>0)
{
innerText=""+innerText+" ";
style.display="block";
style.left=event.clientX;
style.top=event.clientY+15;
}
}
} function mouseout(obj)
{
with (document.all.div_hint)
style.display="none";
}
</script>
</head>
<body>
<form id="queryForm" method="post">
<table id="layerOne" cellspacing="0" cellpadding="0" width="98%" border="0"
align="center" cssclass="table_listoutline">
<select name="name" onmouseover="mouseclick(this)" onmouseout="mouseout(this);" />
</table>
</form>
</body>
<iframe id="myframe" frameborder="0"
style="position:absolute;
width:expression(this.nextSibling.offsetWidth);
height:expression(this.nextSibling.offsetHeight);
top:expression(this.nextSibling.offsetTop);
left:expression(this.nextSibling.offsetLeft);
border="0" scrolling="no">
</iframe>
<div id=div_hint
style="font-size:12px;color:black;display:none;position:absolute;zIndex:10;top:200;
background-color:#FCFDCC;layer-background-color:#0099FF;border:1 #9c9c9c
solid;filter:alpha(style=0,opacity=80,finishOpacity=100);">
</div>
</html>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货