不能在asp.net中调用function (window){}

本文关键字:window function 调用 asp net 不能 | 更新日期: 2023-09-27 18:06:34

如何从asp.net c#中调用addRect函数

我试过了,但是它不能调用这个函数,我该怎么用呢?

(function (window) {    
    function addRect(x, y, w, h, fill, flag, count) { }
})(window);
Page.ClientScript.RegisterStartupScript(this.GetType(), "addRect", "addRect(x,y,w,h,fill,flag,count);", true);

不能在asp.net中调用function (window){}

try this;

<script type="text/javascript" language="javascript">
    function myfunction(x) {
        alert(x)
    }
</script>

和后面的代码;

string myfunction= "myfunction(" + myvalue+ ")";
ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "myfunction", myfunction, true);