我根据需要转换了这段代码
http://jquerymsgbox.ibrahimkalyoncu.com/
大家好,我编写了以下代码来显示警报
public static string ShowAlertMessage(string pHeader, string pError, Page page)
{
//StringBuilder sb = new StringBuilder();
StringBuilder strScript = new StringBuilder();
strScript.Append("<script type='text/javascript' src='Scripts/jquery-1.4.1.js'>");
strScript.Append("</script>");
strScript.Append("<script type='text/javascript' src='Scripts/jquery.msgBox.js'>");
strScript.Append("</script>");
strScript.Append("<link href='Styles/msgBoxLight.css' rel='stylesheet' type='text/css'>");
strScript.Append("</link>");
strScript.Append("<script type='text/javascript'>");
strScript.Append("function example()");
strScript.Append("{");
strScript.Append("$msgBox({");
strScript.Append("title:" + pHeader + "");
strScript.Append(",");
strScript.AppendLine("content:" + pError + "");
strScript.Append("});");
strScript.Append("}");
strScript.Append("</script>");
page.ClientScript.RegisterStartupScript(page.GetType(), "Script", strScript.ToString(), true);
return strScript.ToString();
}
但这并没有给我预期的输出可以有人帮助我哪里出错了
这是生成的字符串生成器
<script type='text/javascript' src='Scripts/jquery-1.4.1.js'></script>
<script type='text/javascript' src='Scripts/jquery.msgBox.js'></script>
<link href='Styles/msgBoxLight.css' rel='stylesheet' type='text/css'></link>
<script type='text/javascript'>
function example()
{
$msgBox({title:Testing Code,
content:Hello
});
}
</script>