【问题标题】:IE 6 DropDown tooltipIE 6 下拉工具提示
【发布时间】:2011-09-21 14:14:40
【问题描述】:

我只需要为 IE6 的下拉选择框放置工具提示。要求是,我有宽度:150px 的选择框,并且我有 4 个选项值。选项值内的文本大于 '150px' 所以,它是没有在选择框中显示完整的文本。而不是增加选择框的大小,我需要显示一个带有整个文本的工具提示。如果有人有任何想法,请帮助我。

【问题讨论】:

    标签: internet-explorer-6 drop-down-menu tooltip


    【解决方案1】:

    这是与 ASP.net 下拉列表控件一起使用的代码

    此代码段提供下拉列表的工具提示。 下拉列表可以设置为较小的宽度,工具提示将显示 下拉列表中的值。

    ****JavaScript 部分*** ****

    <SCRIPT language="JavaScript">
    <!--
    showHideTooltip = function ()
    {
    var obj = document.getElementById("DropDownList1");
    document.getElementById("tooltip").innerHTML =
    obj.options[obj.selectedIndex].value;
    if(event.type == "mouseleave")
    {
    document.getElementById("tooltip").style.display = "none";
    }
    else
    {
    document.getElementById("tooltip").style.display = "inline"
    document.getElementById("tooltip").style.top = event.y;
    document.getElementById("tooltip").style.left = event.x;
    }
    }
    //-->
    </SCRIPT>
    

    *******aspx页面的HTML部分****

    <form id="Form1" method="post" runat="server">
    <SPAN id="tooltip" style="BORDER-RIGHT: #000000 1px solid; PADDING-RIGHT:
    3px; BORDER-TOP: #000000 1px solid; DISPLAY: inline; PADDING-LEFT: 3px;
    FONT-SIZE: 12px; PADDING-BOTTOM: 3px; BORDER-LEFT: #000000 1px solid;
    PADDING-TOP: 3px; BORDER-BOTTOM: #000000 1px solid; FONT-FAMILY: Verdana;
    POSITION: absolute; BACKGROUND-COLOR: #a6bed9">
    </SPAN>
    <aspropDownList id="DropDownList1" style="Z-INDEX: 101; LEFT: 104px;
    POSITION: absolute; TOP: 160px"
    runat="server" Width="80px" Height="24px">
    <asp:ListItem Value="One" Selected="True">One</asp:ListItem>
    <asp:ListItem Value="Two">Two</asp:ListItem>
    <asp:ListItem
    Value="Threeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeeeeee">Threeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeeeeeeeeee</asp:ListItem>
    <asp:ListItem Value="Four">Four</asp:ListItem>
    <asp:ListItem Value="Five">Five</asp:ListItem>
    </aspropDownList>
    </form>
    

    【讨论】:

      【解决方案2】:

      在 IE6 中将没有类似工具提示的选项用于下拉菜单。如果文本很长,我们可以通过任何方式增加下拉菜单的宽度... 在 Ajax 工具包中使用组合框,这样我就有了默认属性来增加大小。

      <cc1:ComboBox Width="130px" ID="txtCPLegalNameValue" AutoPostBack="True"
                    OnTextChanged="ddlName_Change"  AppendDataBoundItems="false"  
                   runat="server" AutoCompleteMode="SuggestAppend" >    </cc1:ComboBox>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2010-10-15
        • 1970-01-01
        • 2020-10-07
        • 1970-01-01
        • 2015-01-12
        • 1970-01-01
        • 2017-08-30
        • 1970-01-01
        相关资源
        最近更新 更多