我的理解是,联合材料在执行守则之前,先完成各项职能。 因此,职能命令无关紧要。 但是,职能命令在将*.js文档连接起来时就成为一个问题。
For example,
<script src="@Url.Content("~/Scripts/Personal/MyJScript.js")" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
hello();
afterCall();
hello2(); //fails, defined in MyJScript2.js
});
function afterCall() {
alert( inline function defined after call );
}
</script>
<script src="@Url.Content("~/Scripts/Personal/MyJScript2.js")" type="text/javascript"></script>
在上述代码中,功能代码
Considering I perform $(document).ready
, the document should be as ready as it gets. So, why does this happen?
As requested, here is the client side HTML
<body>
<script src="/Scripts/Personal/MyJScript.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
hello();
afterCall();
hello2(); //fails
});
function afterCall() {
alert( inline function defined after call );
}
</script>
<script src="/Scripts/Personal/MyJScript2.js" type="text/javascript"></script>
</body>