开发者

Call javaScript Function Server Side

I wrote this javascript Function :

      开发者_StackOverflow中文版 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


'Saved' parameter is missing the quotes

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


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); 



}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜