gpt4 book ai didi

javascript - Internet Explorer 中的文本换行不正确

转载 作者:行者123 更新时间:2023-11-28 13:40:58 24 4
gpt4 key购买 nike

为用户提供帮助 - 当他们点击问号时出现一个 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 中正确换行文本?

最佳答案

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

关于javascript - Internet Explorer 中的文本换行不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12402811/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com