0

当用户输入错误的 ıd 或密码时,我想显示一个消息框。我将以下函数写入 .aspx 文件:

 <script type="text/javascript">
    function warningMessage() {
        $.msgBox({
            title: "Hatalı Giriş",
            content: "Kullanıcı numarası ya da şifre hatalı...",
            type: "error",
            buttons: [{ value: "Ok" }]              
        });
    }
</script>

我将以下代码写入 aspx.cs 文件:

ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "warningMessage  ", "warningMessage()", false);

但这段代码不起作用。你能帮助我吗?

4

1 回答 1

0

使用此插件时,需要包含 3 个文件:

<script src="Scripts/jquery-2.0.0.js" type="text/javascript"></script>
<script src="Scripts/jquery.msgBox.js" type="text/javascript"></script>
<link href="Styles/msgBoxLight.css" rel="stylesheet" type="text/css">  

我在客户端使用了这段代码:

<script type="text/javascript">
    function warningMessage() {
        $.msgBox({
            title: "Hatalı Giriş",
            content: "Kullanıcı numarası ya da şifre hatalı...",
            type: "error",
            buttons: [{ value: "Okay"}]  
        });
    }
</script>  

在服务器端:

Page.ClientScript.RegisterStartupScript(this.GetType(), null, "warningMessage();", true);  

这对我来说很有效

于 2013-06-22T10:10:40.537 回答