Inline jquery script to a separate js file with asp.net master pages
Hai guys, How to include inline jquery scripts used in an aspx to a separate js fi开发者_JAVA技巧le with asp.net master pages
Your masterpage can have a script link to the core Jquery file:
<html>
<head runat="server" >
<title>Master page title</title>
//link to Jquery script
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<asp:contentplaceholder id="Head" runat="server" />
</head>
<body>
.
<asp:contentplaceholder id="Main" runat="server" />
.
</body>
ASPX page can have other script links specific to the page only
<% @ Page Language="C#" MasterPageFile="~/Master.master" Title="Content Page 1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Head" Runat="Server">
//other scripts specific to this page only
<script type="text/javascript" src="js/jquery.plugin.abc.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Main" Runat="Server">
Main content.
</asp:Content>
精彩评论