【问题标题】:set the size of the tooltip dialog box depending on the text根据文本设置工具提示对话框的大小
【发布时间】:2010-04-30 17:52:47
【问题描述】:

如何设置工具提示对话框的大小。工具提示文本必须显示在一行中,而不是将文本换行到另一行。

在 Firefox 和 IE7 中,工具提示文本显示在一行中,但在 IE8 中,工具提示文本被换行。即文本显示为 2 行。

asp:Image runat="server" ID="iUrl" Visible="false" ImageUrl="~/Widgets/FMP_Printers/images/status icons/icon_Fault_Enabled.gif" />

  if (txtUrl.Text.ToUpper().IndexOf("HTTP://") < 0 && txtUrl.Text.ToUpper().IndexOf("HTTPS://") < 0)
    {
        iUrl.Visible = true;

        iUrl.ToolTip = "ghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghgh";
        valid = false;
    }

【问题讨论】:

    标签: asp.net


    【解决方案1】:

    工具提示在所有浏览器中的处理方式不同。 Firefox 忽略 \n “新行”,但 IE 接受它们。问题不在于您的代码,而在于 ToolTip 本身。它只会按照自己的行为行事。但是,您可以使用 javascript 在鼠标悬停时显示 div 并在鼠标移出时将其隐藏。这将实现与工具提示类似的功能,您可以根据需要设置格式。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-18
      • 1970-01-01
      • 1970-01-01
      • 2015-03-27
      • 1970-01-01
      • 2015-11-23
      • 1970-01-01
      • 2013-04-01
      相关资源
      最近更新 更多