How to load JavaScript in View to MasterPage?
====
1. 在MasterPage的head區段中定義ContentPlaceHolder,讓View可以放入JavaScript:
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>
<asp:ContentPlaceHolder ID="head" runat="server" />
</head>
2. 在View中加入對應的Content:
<asp:Content ID="Content3" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript" src="../../Scripts/tiny_mce/tiny_mce.js"></script>
...
</asp:Content>
沒有留言:
張貼留言