是他们的一种方式,我可以将javascript嵌入到GWT代码

Is their a way by which I can embed the javascript inside the GWT code?

本文关键字:javascript 代码 GWT 我可以 他们的 方式 一种      更新时间:2023-09-26

final HTML statushHTML = new HTML(" ", true);

statushHTML.setHTML(结果);

//在结果中传递字符串

<>之前1. Result = < bold <b>//显示粗体2. Result = &lti>斜体<i>//它可以工作3.Result = &ltfont color='red'> red <font>//再次运行4. Result = &lth1> h1 tag <h1>//这也可以正常工作但如果我尝试5. result = &ltscript> alert('No output') <script>//现在不工作了它只是以字符串格式显示。

如果需要插入脚本,请使用ScriptInjector .

示例代码:

String script = "alert('No output')";
ScriptInjector.fromString(script).inject();