关闭

SELECT列表框提示

577人阅读 评论(0) 收藏 举报
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
 <script>
//定义Popup
var oP=window.createPopup();
oP.document.body.style.background="beige";
//popup是否已显示
var oPShow=0;
var lineCharCount=20;
var lineCount=new Number(0);
var subLine=new String();
function showTitle(obj){
var h=event.offsetY;
var fontsize=(obj.style.fontSize==""?(obj.currentStyle.fontSize==""?"9":obj.currentStyle.fontSize):obj.style.fontSize);
fontsize=parseInt(fontsize)*1.6;
var l=parseInt(h/fontsize);
if(null!=obj.options[l]){
 lineCount=0;
 subLine=obj.options[l].text;
 
 oP.document.body.innerText="";
 do{
  if(subLine.length>lineCharCount){
   oP.document.body.innerHTML+=subLine.substr(0,lineCharCount)+"<br>";
   subLine=subLine.substr(lineCharCount,subLine.length-lineCharCount);
   lineCount+=1;
  }
 }while(subLine.length>lineCharCount)
oP.document.body.innerHTML+=subLine;
lineCount+=1;
len=lineCharCount*8;
oP.show(event.offsetX+20,event.offsetY+fontsize+5,len,lineCount*(fontsize+2),document.body);
oPShow=1;
}
}
function hideTitle(obj){
if(oPShow==1)oP.hide();
}
</script>
<title>无标题文档</title>
</head>
<body>
<form name="form1" method="post" action="">
  <div id=div1 style="overflow:auto;width:100px;">
    <select name=s1 size=7 style="width:120;height:60%" onmousemove="showTitle(this);" onmouseout="hideTitle(this);">
      <option>aaaaaaaaaaaaaaaaaaaaaa1
      <option>012345678901234567899876543210987654321074102589637410258963963258741096328574107896321450789632145098741236509874123650
      <option>cccccccccccccccccccccccc1
      <option>ddddddddddddddddddddddd1
      <option>eeeeeeeeeeeeeeeeeeeeeee1
      <option>fffffffffffffffffffffffffff1
    </select>
  </div>
 
</form>
</body>
</html>
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:18516次
    • 积分:237
    • 等级:
    • 排名:千里之外
    • 原创:4篇
    • 转载:6篇
    • 译文:0篇
    • 评论:1条
    文章分类
    最新评论