MVC中的负载处理程序在哪里?

Pom*_*ter 2 asp.net-mvc onload

我想将代码添加到我的Onload处理程序但不确定它在MVC应用程序中的位置?

 // You may want to place these lines inside an onload handler
 CFInstall.check({
     mode: "overlay",
     destination: "http://localhost:1414/"
 });
});
Run Code Online (Sandbox Code Playgroud)

上面的代码需要放在onload处理程序中.

jwa*_*zko 7

如果我正确理解你,如果你使用jQuery,你只需要下面这个表达式:

<script>
    $(document).ready(function() {
        // Handler for .ready() called. Put your logic here.
    });
</script>
Run Code Online (Sandbox Code Playgroud)

或者这个,不使用jQuery:

<script>
    window.onload = function(){
        // Put your logic here.        
    } 
</script>
Run Code Online (Sandbox Code Playgroud)

要包含在view.cshtml中.