0

我正在使用这个弹出工具提示: http ://www.dynamicdrive.com/dynamicindex16/showhint.htm

这样每当我将鼠标悬停在 [?] 符号上时,就会出现一条消息。

在提供的脚本中:

<a href="#" class="hintanchor" onMouseover="showhint('Please choose a username. Should consist of alphanumeric characters only.', this, event, '150px')">[?]</a>

我的意思是输入文本以显示在showhint函数内的弹出窗口中,如上所示。

我的问题是我有大量的文本要显示(即半页 Word 文档大小),并且需要在段落之间安排中断。

当我将文本块放在 showhint 函数的第一个参数中时,它不起作用。

如何获得工具提示以显示带有适当中断等的长消息?

谢谢!

4

6 回答 6

1

您正在使用的“显示提示”脚本似乎接受 HTML 标签,例如inside - 这样您就可以将文本放在一个段落中

<a href="#" class="hintanchor" onMouseover="showhint('<p>Please choose a username.</p><p>Should consist of alphanumeric characters only.</p>', this, event, '150px')">[?]</a>
于 2013-04-18T07:39:16.523 回答
1

您可以在 showhint 文本本身中添加 html 标签,如下所示。有用。

<a href="#" class="hintanchor" onmouseover="showhint('<b>Please choose a username.</b> &lt;p&gt;Should consist of alphanumeric characters only.&lt;/p&gt;', this, event, '150px')">[?]</a>
于 2013-04-18T07:39:25.443 回答
1

你试过把 \n 或 \n\r 或 <br> 或 <br/> 放在你想要休息的地方吗?这在过去帮助了我

于 2013-04-18T07:39:45.893 回答
1

在您的弹出 css 中使用 word-wrap 属性,如下所述

     <div id='row' style='word-wrap:break-word;'>

它将相应地包装文本

    #hintbox{ 
     /*CSS for pop up hint box */ 
    position:absolute; top: 0; 
    background-color:lightyellow; width: 150px;
    /*Default width of hint.*/ 
    padding: 3px; border:1px solid black;  
    font:normal 11px Verdana; 
    line-height:18px; 
    z-index:100; 
    border-right: 
    3px solid black; 
    border-bottom: 
    3px solid black; 
    visibility: hidden; 
    Word-wrap:break-word; 

}

于 2013-04-18T08:45:54.230 回答
1

通常不是这样,悬停帮助的用途是什么。也许你最好使用 showhint 来显示一个预告片和一个链接来打开一个类似边栏的东西,你可以在其中显示普通的 html,并且在用户输入时保持显示。

文档说HTML 是受支持的,所以你尝试过这样的文本:

<html>line-1<br/>line-2</html>
于 2013-04-18T07:45:03.457 回答
1

您是否尝试使用 <br> 换行?(没有空格)

像那样:

<a href="#" class="hintanchor" onMouseover="showhint('Please choose a username. <br> Should consist of alphanumeric characters only.', this, event, '150px')">[?]</a>
于 2013-04-18T07:54:07.430 回答