我在我的ASP.NET定期添加了jQuery母版頁
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Color Items</title>
<script src="http://code.jquery.com/jquery-latest.js"
type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$("select option:even").addClass('evenColor');
});
</script>
<style type="text/css">
.evenColor
{
background-color:Gray;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem Text="Gori"></asp:ListItem>
<asp:ListItem Text="Muf"></asp:ListItem>
<asp:ListItem Text="Lizo"></asp:ListItem>
</asp:DropDownList>
</div>
</form>
</body>
</html>
頁下面的jQuery現在我想將它轉換成一個母版頁。我無法確定要添加到主頁面的內容以及內容頁面的內容。腳本是否會轉到MasterPage?
請注意:我有許多這樣的常規asp.net頁面與個人jquery文件。我必須將所有這些jquery文件添加到一個母版頁中。
什麼是正確的方法?
我在哪裏可以在內容頁面添加JavaScript? – Hitz 2009-10-19 10:09:29
如果使用ScriptManager控件,可以使用'ScriptManager manager = ScriptManager.GetCurrent(this); manager.Scripts.Add(新的ScriptReference( 「myJavaScriptfile.js」));'或增加它在ASPX標記,在''內,一對夫婦的選擇。 –
2009-10-19 10:39:04