0

为用户提供帮助 - 当他们单击问号时会出现一个 div:

一个 javascript 函数使 div 出现:

function showhelpby(whichdiv,e,divwidth,leftorright,message)
{
    e=(!e)?window.event:e;//IE:Moz

    document.getElementById(whichdiv).style.display = 'block';
    document.getElementById(whichdiv).style.width = divwidth + 'px';
    if (leftorright == 'left')
    {
        if (e.pageX)
        {
        document.getElementById(whichdiv).style.left = e.pageX - divwidth - 20 + 'px';
        document.getElementById(whichdiv).style.top = e.pageY + 'px';
        }
        else if(e.clientX)
        {
        document.getElementById(whichdiv).style.left = window.event.clientX - divwidth - 20 + 'px';
        document.getElementById(whichdiv).style.top = window.event.clientY + 'px';    
        }
    }
    else
    {
        if (e.pageX)
        {
        document.getElementById(whichdiv).style.left = e.pageX + 20 + 'px';
        document.getElementById(whichdiv).style.top = e.pageY + 'px';
        }
        else if(e.clientX)
        {
        document.getElementById(whichdiv).style.left = window.event.clientX + 20 + 'px';
        document.getElementById(whichdiv).style.top = window.event.clientY + 'px';
        }
    }
    document.getElementById('message').innerHTML = message;
}

出现的 div 的 css 是:

div.notes
{
font-family: Verdana;
font-size: 12px;
color: #000066;
line-height:140%;
display:none;
border-style:solid;
border-width:2px;
border-color:#000099;
position:absolute;
padding:15px;
background-color:#FFFFFF;
background-image:url(images/F3F3F3White200.jpg);
background-repeat:repeat-x;
overflow-y:auto;
overflow-x:hidden;
z-index:201;
}

并且在 div 中显示的文本位于<p>未应用 css 样式的标签中。

多年来,我一直在使用上面的内容来显示弹出的小“帮助”div。

现在,突然之间,在 Visual Studio 2010 中开发一个站点 - 用于 Intranet - 正在使用 IE 9(我们必须使用 IE)查看(发布后) - 我的帮助 div 中的文本没有正确换行。文本看起来是合理的,单词会随心所欲地中断。这与长词不中断无关。单词“the”可能在一行以“t”结尾,而在下一行以“he”结尾。

除了通常喋喋不休地抱怨“该死的 Internet Explorer - 他们什么都做对了吗?” - 任何人都知道我需要做些什么才能在固定宽度的 div 中正确地换行文本?

4

1 回答 1

0

您是否尝试过添加分词:正常? http://www.w3schools.com/cssref/css3_pr_word-wrap.asp

于 2013-03-15T14:51:54.767 回答