下拉菜单选项内容过长的问题

yugang1219 2005-03-27 01:17:45
我的下拉菜单选项内容过长,我想做成将鼠标放在选项上面的时候把这条选项的全部内容显示出来,应该怎么做呢?
...全文
511 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
scoutlin 2005-03-27
  • 打赏
  • 举报
回复
改得比较匆忙
你自己再修改一下

<div>
<input readonly style="width:120" name=mselect onmouseover="showt(this)" onmouseout="hideTitle(this)"><input type=button value="6" style="font-family:webdings;font-size:9px" onclick="droplist(this)">
</div>
<div id=div1 style="display:none;overflow:auto;height:expression(5*15);width:expression(document.all.mselect.offsetWidth+18);">
<select name=s1 size=6 style="width:expression(document.all.mselect.offsetWidth);" onmousemove="showTitle(this);" onmouseout="hideTitle(this);" onclick="schange(this);">
<option>aaaaaaaaaaaaaaaaaaaaaa1
<option>bbbbbbbbbbbbbbbbbbbbbbbbb1
<option>cccccccccccccccccccccccc1
<option>ddddddddddddddddddddddd1
<option>eeeeeeeeeeeeeeeeeeeeeee1
<option>fffffffffffffffffffffffffff1
</select>
</div>
<script>
document.all.mselect.value=document.all.s1.options[0].text

//定义Popup
var oP=window.createPopup();
oP.document.body.style.background="beige";
//popup是否已显示
var oPShow=0;
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);
oP.document.body.innerText=obj.options[l].text;
len=obj.options[l].text.length*8;
oP.show(event.offsetX+20,event.offsetY+fontsize+5,len,fontsize,document.body);
oPShow=1;
}
function hideTitle(obj){
if(oPShow==1)oP.hide();
}
function showt(obj){
oP.document.body.innerText=obj.value
var len=obj.value.length*8;
oP.show(event.offsetX+20,event.offsetY+20,len,15,document.body);
oPShow=1;
}
function schange(obj){
document.all.mselect.value=obj.options[obj.selectedIndex].text;
obj.parentElement.style.display='none';
}
function droplist(obj)
{
event.cancelBubble=true
div1.style.top=document.all.mselect.getBoundingClientRect().top;
div1.style.left=document.all.mselect.getBoundingClientRect().left;
div1.style.display=''
document.all.mselect.focus();
}
document.body.onclick=function(){
div1.style.display='none'
}
</script>
yugang1219 2005-03-27
  • 打赏
  • 举报
回复
下拉菜单的option是不是不支持onmouseover?
yugang1219 2005-03-27
  • 打赏
  • 举报
回复
不是这个意思,我是说选项的值太长,各个选项不是那种关联的
zhangjin0997 2005-03-27
  • 打赏
  • 举报
回复
把它分类然后用下拉框联动的方法解决吗!
yugang1219 2005-03-27
  • 打赏
  • 举报
回复
我想的是下拉菜单打开的时候鼠标放在选项上时显示选项的全部内容,楼上的大哥给的例子虽好,但是还是不行
scoutlin 2005-03-27
  • 打赏
  • 举报
回复
http://blog.csdn.net/scoutlin/archive/2005/02/22/297701.aspx
yugang1219 2005-03-27
  • 打赏
  • 举报
回复
不可以吗?鼠标放在上面用title的形式把内容完全显示出来
lstup 2005-03-27
  • 打赏
  • 举报
回复
这好象不可以吧。
yugang1219 2005-03-27
  • 打赏
  • 举报
回复
没人回答?自己顶
大家好,又见面了!EasyUI又更新了,这次更新内容还是不少的,具体内容请参考下面的更新说明,官方的更新说明中还少了1条,我给补上了。 jQuery EasyUI 1.3.5版本更新内容: Bug(修复) searchbox:修复“searcher”函数提供的“name”参数值错误的问题; combo:修复“isValid”方法无法返回布尔值的问题; combo:修复点击页面某一个combo组件的下拉列表时触发的“onHidePanel”事件会导致页面上其他combo组件的下拉列表被关闭的问题; combogrid:修复某些从combo组件继承来的方法无法使用的问题。 Improvement(改进) datagrid:改进检查行时候的性能; menu:允许追加菜单分隔符; menu:新增“hideOnUnHover”属性用于在鼠标离开菜单的时候指示是否需要隐藏菜单; slider:新增“clear”和“reset”方法; tabs:新增“unselect”方法、“onUnselect”事件; tabs:新增“selected”属性,用于指定的默认打开的面板; tabs:Tab Panel(Tab页)新增“collapsible”属性,用于设置是否允许摺叠面板; tabs:新增“showHeader”属性、“showHeader”方法和“hideHeader”方法; combobox:允许“disabled”属性禁用下拉列表选项; tree:改进数据加载时候的性能; pagination:新增“layout”属性,用于自定义控件的样式布局; accordion:新增“unselect”方法、“onUnselect”事件; accordion:新增“select”和“multiple”属性; accordion:新增“getSelections”方法; datebox:新增“sharedCalendar”属性,允许多个datebox控件共享使用同一个calendar控件。 datebox:新增“buttons”属性,用于自定义日历下方的按钮。 (译者注:该点更新内容官方更新公告上没有注明,具体内容和用法请看datebox的API。) 历史版本: - jQuery EasyUI 1.3.4 离线API简体中文版 http://download.csdn.net/detail/richie696/6302785 - jQuery EasyUI 1.3.4 离线API简体中文版 http://download.csdn.net/detail/richie696/5363933

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧