0

如何从 java 脚本创建动态表?我正在从数据库中获取记录并将其存储到变量中并将该值添加到表单元格中。在这里,我放了一些文本而不是实际值。

在cs文件的按钮单击事件中我这样做

StringBuilder sb = new StringBuilder();
sb.Append(@"<script language='javascript'>");
sb.Append("<table><tbody><tr><td>Information</td></tr></tbody></table>");
sb.Append(@"</script>");

if (!Page.ClientScript.IsClientScriptBlockRegistered(Page.GetType(), "HeyPopup"))

ClientScript.RegisterClientScriptBlock(Page.GetType(), "HeyPopup", sb.ToString());

但是我看不到信息。

4

1 回答 1

1

您必须在脚本中添加 document.Write

so replace with

sb.Append("document.write('<table><tbody><tr><td>Information</td></tr></tbody></table>');");
于 2012-07-04T12:22:14.723 回答