[英]How to add bold text in Tooltips in Javascript?
I'm using a native javascript method in my gwt project und try to add tooltips in the RTA http://www.gwtproject.org/javadoc/latest/com/google/gwt/user/client/ui/RichTextArea.html . 我在gwt项目中使用了本机javascript方法,并尝试在RTA中添加工具提示http://www.gwtproject.org/javadoc/latest/com/google/gwt/user/client/ui/RichTextArea.html 。 That works fine by using:
使用以下命令可以正常工作:
private native void addHtmlSpanHighlight(Element elem, String type,
String objectId, String tooltip)/*-{
var range = elem.contentWindow.getSelection().getRangeAt(0), content = range
.extractContents(), span = document.createElement('SPAN');
span.setAttribute("type", type);
span.setAttribute("value", objectId);
span.setAttribute("style", "background-color:#ffd700");
span.setAttribute("title", tooltip)
span.appendChild(content);
var htmlContent = span.innerHTML;
range.insertNode(span);
elem.blur();
}-*/;
So the span has the tooltip. 因此,范围具有工具提示。 But here is my question:
但是这是我的问题:
Is there any smart and easy possibility to set bold tags in the String of the tooltip (example : title="This is a Test ) without using css or javascript frameworks?
在不使用css或javascript框架的情况下,是否可以在工具提示的字符串中设置粗体标签(例如:title =“ This是Test ”),这是一种既聪明又容易的可能性?
Many thanks in advance for your help. 在此先感谢您的帮助。
You cannot style tooltips. 您不能设置工具提示的样式。
You can create a different element that will act as a tooltip, and style it. 您可以创建一个不同的元素作为工具提示,并设置其样式。 One possible technique is described here:
这里描述了一种可能的技术:
http://sixrevisions.com/css/css-only-tooltips/ http://sixrevisions.com/css/css-only-tooltips/
尝试使用DecoratedPopupPanel,然后为面板添加鼠标悬停处理程序,请参见此链接中的示例
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.