我想知道如何在 jsp 网页中突出显示从 jsp 或 serlevt 传递的文本变量。我不想使用 onclick 调用 javascript,有什么方法可以进入该页面,然后网页中的文本已经用黄色突出显示。
谢谢你的帮助!!
我想知道如何在 jsp 网页中突出显示从 jsp 或 serlevt 传递的文本变量。我不想使用 onclick 调用 javascript,有什么方法可以进入该页面,然后网页中的文本已经用黄色突出显示。
谢谢你的帮助!!
也许您可以使用 onload 突出显示文本:)
你可以尝试类似的东西window.onload=func1;
function func1() {
document.getElementById("yourtext").style.backgroundColor="#f3f3f3";
}
也许您应该考虑在对象的特定类上使用 css background-color 属性?或者可能只是在您将对象传递给 html 时内联。
您可以将特定的类或 Id 添加到文本中,然后根据需要设置样式
<span id="mytext">this is what you want to style</span>
然后在你的 CSS
#mytext{color:yellow;}
带一堂课
<span class="mytext">this is what you want to style</span>
<span class="mytext">this is what you want to style</span>
<span class="mytext">this is what you want to style</span>
然后在你的 CSS
.mytext{color:yellow;} // this will apply to all span with the class mytext