调用 javaScript 函数服务器端

发布于 2024-10-05 02:47:03 字数 775 浏览 2 评论 0原文

我写了这个 javascript 函数:

       function ShowMsg(msg) {
                $.blockUI({
            message: '<div dir=rtl align=center><h1><p>' + msg + '</p></h1></div>',
            css: { 
                border: 'none',
            padding: '15px',
            backgroundColor: '#000',
            '-webkit-border-radius': '10px',
            '-moz-border-radius': '10px',
            opacity: .5,
            color: '#fff'
            }
        });

        setTimeout($.unblockUI, 2000); 



    }

我想在 asp.net 上调用这个函数服务器端:

Page.ClientScript.RegisterClientScriptBlock([GetType](), "script", "ShowMsg(" & "Saved" & ");", True)

但它不起作用。 该函数无需参数即可工作。 是否存在语法错误? 谢谢

I wrote this javascript Function :

       function ShowMsg(msg) {
                $.blockUI({
            message: '<div dir=rtl align=center><h1><p>' + msg + '</p></h1></div>',
            css: { 
                border: 'none',
            padding: '15px',
            backgroundColor: '#000',
            '-webkit-border-radius': '10px',
            '-moz-border-radius': '10px',
            opacity: .5,
            color: '#fff'
            }
        });

        setTimeout($.unblockUI, 2000); 



    }

i want to call this Function Server Side at asp.net :

Page.ClientScript.RegisterClientScriptBlock([GetType](), "script", "ShowMsg(" & "Saved" & ");", True)

But it does not work.
the function is work without argument.
is there any syntax error exist?
thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

通知家属抬走 2024-10-12 02:47:03

“已保存”参数缺少引号

Page.ClientScript.RegisterClientScriptBlock([GetType](), "script", "ShowMsg('" & "Saved" & "');", True)

'Saved' parameter is missing the quotes

Page.ClientScript.RegisterClientScriptBlock([GetType](), "script", "ShowMsg('" & "Saved" & "');", True)
蓬勃野心 2024-10-12 02:47:03

此类错误您可以通过 javascript 调试来检查。启用 JavaScript 调试。
转到:工具>互联网选项>高级>浏览并取消选中(禁用脚本调试)。
在 Internet Explorer 浏览器中
。然后你可以通过编写调试器来附加调试器; @ javascript函数中的任何位置egs:

function ShowMsg(msg) {
*

  • 调试器;

*
$.blockUI({
消息:'

'+msg+'

',
css: {
border: 'none',
padding: '15px',
backgroundColor: '#000',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
opacity: .5,
color: '#fff'
}
});

    setTimeout($.unblockUI, 2000); 



}

These kind of errors you can check through javascript debugging. to enable javascript debugging.
go to : tools > intenet options > advanced > browsing and uncheck (disable script debugging).
in Internet Explorer Browser
. then you can attach debugger by writing debugger; @ any location in javascript function egs:

function ShowMsg(msg) {
*

  • debugger;

*
$.blockUI({
message: '

' + msg + '

',
css: {
border: 'none',
padding: '15px',
backgroundColor: '#000',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
opacity: .5,
color: '#fff'
}
});

    setTimeout($.unblockUI, 2000); 



}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文