我在 ASPX 页面中有这个 JavaScript 代码
<script>
function show_modal(statut)
{
if (statut == true)
{
$(function ()
{
$('#modal_success').modal('show')
})
}
else
{
$(function ()
{
$('#modal_fail').modal('show')
})
}
}
</script>
这显示了一个模态弹出窗口,我喜欢从后面的代码中启动它。
我试过这个,但没有奏效:
if (resultat)
{
ClientScript.RegisterStartupScript(this.GetType(), "", "show_modal(true);");
}
else
{
ClientScript.RegisterStartupScript(this.GetType(), "", "show_modal(false);");
}
但我不知道为什么!