我有一些 html 内容要在 jquery 对话框 onclick 中显示。这是示例代码
html代码(内部php):
<div id = '".$id."' style='display:none' >".$toperrors." </div>
<td align='center' onclick='toperrors($id);' > <img src='images/minimize.jpg' width=30
height=20 ></img> </td>
查询:
function toperrors(str){
$("#dialog").html("");
$("#dialog").html($("div#"+str).html());
$("#dialog").dialog({
title: "Top errors",
modal: true,
width: "800px",
height: 400,
buttons:
{"OK":function() {
$(this).dialog("close");
}
}
});
}
如果 $toperrors 包含一个字符串,则代码运行良好,没有任何问题。
但是如果我将 html 内容分配给 $toperrors 变量。然后将html内容打印在网页
本身上。也许它没有隐藏在 div 中的 style='display:none' 中。任何帮助将不胜感激。谢谢。