现在的位置: 首页 > 综合 > 正文

SELECT列表框提示

2013年09月02日 ⁄ 综合 ⁄ 共 1726字 ⁄ 字号 评论关闭
<!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>

抱歉!评论已关闭.