如果用下面這個方法去使用外部的JavaScript的話,在某些狀況下會不能用在AJAX的部分更新上

<script type ="text/javascript" src="myJavaScript.js">

</script>

所以要這樣註冊(CompositeScript是將多個js合起來降低傳輸量增加效能)

<asp:ScriptManager ID="ScriptManager1" runat="server">

<CompositeScript>

   <scripts>

      <asp:ScriptReference Path="~/myJS/myJavaScript.js"/>

      <asp:ScriptReference Path="~/myJS/myJavaScript2.js"/>

   </scripts>

</CompositeScript>

</asp:ScriptManager

另外下面可通知Script檔案是否載入完畢

if(typeof(Sys)!='undefined')

{

     Sys.Application.notifyScriptLoaded

}

arrow
arrow
    全站熱搜

    welkingunther 發表在 痞客邦 留言(4) 人氣()