用于在工具提示中显示所选项目下拉菜单的JavaScript [英] javascript to show the selected item of dropdown in tooltip

查看:64
本文介绍了用于在工具提示中显示所选项目下拉菜单的JavaScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个下拉列表,由于它的宽度很小,在IE中的单词正在剪切,我想在使用javascript鼠标悬停在ddl项目时显示它们。

解决方案

试试这些:



http://www.daniweb.com/web-development/javascript-dhtml-ajax/threads/113240/tooltips-for-drop-down-boxes# [ ^ ]

http://www.velocityreviews.com/forums/t101413-dropdown-list-show-tool-tip.html [ ^ ]

http://stackoverflow.com/questions/348530/show-tooltip-when-selecting-item-on-aspdropdownlist [ ^ ]


最后这里是ur soln。,



如果您不考虑使用IE 6.0的用户,解决方案是设置标题每个列表项的属性。

如果你想在Dropdownlist的工具提示中显示所选项,那么添加以下脚本块..否则无需使用以下脚本,无需在onchange中调用它事件..

 <   script     type   =  text / javascript >  
function showTip(ddl){
document.getElementById(DropDownList1)。title = ddl;
}
< / script >



 <   asp:DropDownList     ID   =  DropDownList1    runat   =  server   < span class =code-attribute>   onchange   =  showTip(this.value)   工具提示  =  Dhi >  
< asp:ListItem title = Dhi 已选择 = True > Dhi < / asp:ListItem >
< asp:ListItem title = sa > sa < / asp:ListItem >
< asp:ListItem title = boy > boy < / asp :ListItem >
< asp:ListItem title = girl > 女孩< / asp:ListItem >
< / asp:DropDownList >







如果你想为下拉列表实现工具提示控制IE 6.0,soln。我上面发布的是我希望的唯一答案...



如有任何澄清,请回复此...

标记它如果你觉得这很有用......


我希望这能解决问题....



 <   script     type   =  text / javascript >  
function showTip(ddl){
document.getElementById(DropDownList3)。title = ddl;
}
< / script >





 <   div  >  
< ; asp:DropDownList ID = DropDownList3 runat = server onchange = showTip (this.value) 工具提示 = Dhi >
< span class =code-keyword>< asp:ListItem 已选择 = True > Dhi < / asp:ListItem >
< asp:ListItem > sa < / asp:ListItem >
< asp:ListItem > boy < ; / asp:ListItem >
< asp:ListItem > 女孩< / asp:ListItem >
< / asp:DropDownList >
< / div >





如有任何澄清,请回复此...

如果你发现这个有用,请标记它


I have a drop down list and due to its small width, in IE the words are cutting , i want to show them when the mouseover on the ddl items using javascript .

解决方案

Try these:

http://www.daniweb.com/web-development/javascript-dhtml-ajax/threads/113240/tooltips-for-drop-down-boxes#[^]
http://www.velocityreviews.com/forums/t101413-dropdown-list-show-tool-tip.html[^]
http://stackoverflow.com/questions/348530/show-tooltip-when-selecting-item-on-aspdropdownlist[^]


Finally here is ur soln.,

If you don’t consider the users who are using IE 6.0, the solution is to set title attribute for each list item.
If u want to show selected item in Dropdownlist's tool tip, then add the following script block.. Otherwise No need to use the following script and no need to call it in onchange event..

<script type="text/javascript">
        function showTip(ddl) {
            document.getElementById("DropDownList1").title = ddl;
        }
    </script>


<asp:DropDownList ID="DropDownList1" runat="server"  onchange="showTip(this.value)" ToolTip="Dhi">
            <asp:ListItem title="Dhi" Selected="True">Dhi</asp:ListItem>
            <asp:ListItem title="sa">sa</asp:ListItem>
            <asp:ListItem title="boy">boy</asp:ListItem>
            <asp:ListItem title="girl">girl</asp:ListItem>
        </asp:DropDownList>




if you want to implement the tooltip for dropdownlist control in IE 6.0, the soln. posted above by me is the only answer i hope...

For any clarifications reply to this..
Mark it if u find this useful...


Hi, i hope this solves the problem....

<script type="text/javascript">
        function showTip(ddl) {
            document.getElementById("DropDownList3").title = ddl;
        }
    </script>



<div>
           <asp:DropDownList ID="DropDownList3" runat="server" onchange="showTip(this.value)" ToolTip="Dhi">
               <asp:ListItem Selected="True">Dhi</asp:ListItem>
               <asp:ListItem>sa</asp:ListItem>
               <asp:ListItem>boy</asp:ListItem>
               <asp:ListItem>girl</asp:ListItem>
           </asp:DropDownList>
       </div>



For any clarifications reply to this..
Mark it if u find this useful...


这篇关于用于在工具提示中显示所选项目下拉菜单的JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆