0
我一直堅持這一點,所以想通了我會問別人更聰明:)我有一個.NET網站,我試圖使用prettyPhoto Jquery插件。我在主頁面中包含了Jquery主庫和PrettyPhoto.js文件。我在其他的Jquery插件中也遇到過類似的問題,我無法在庫中找到這個函數,那麼避免這些問題的最好方法是什麼?我應該將所有的Jquery文件保存在主頁面中?和CSS鏈接呢?我已經在我的頁面上發佈了代碼,請給出代碼示例如何獲取prettyPhoto()函數。提前致謝!!ASP.net jquery不能找到prettyPhoto()函數
<%@ Page Title="" Language="C#" MasterPageFile="~/Project.Master"
AutoEventWireup="true" CodeBehind="Portfolio.aspx.cs" Inherits="Project.Portfolio" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
debugger;
//This throws error Object doesn't support property or method 'prettyPhoto'
$("ul.gallery").prettyPhoto();
});
</script>
<link rel="stylesheet" href="../Stylesheets/prettyPhoto.css" type="text/css"
media="screen" title="prettyPhoto main stylesheet" charset="utf-8" />
<style type="text/css" media="screen">
ul li { display: inline; }
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div id="main">
<h2>Gallery</h2>
<ul id="picGallery" class="gallery">
<li><a href="../images/Portfolio/fullscreen/2krew.jpg"
rel="prettyPhoto[gallery1]" title="You can add caption to pictures. You can add
caption to pictures. You can add caption to pictures."><img src="../images/thumbnails
/2Krewtn.jpg" width="200" height="200" alt="Red round shape" /></a></li>
<li><a href="../images/Portfolio/fullscreen/anaura"
rel="prettyPhoto[gallery1]" title="You can add caption to pictures. You can add
caption to pictures. You can add caption to pictures."><img src="../images/thumbnails
/anauratn.jpg" width="200" height="200" alt="Red round shape" /></a></li>
<li><a href="../images/Portfolio/fullscreen/closed.jpg"
rel="prettyPhoto[gallery1]" title="You can add caption to pictures. You can add
caption to pictures. You can add caption to pictures."><img src="../images/thumbnails
/Closedtn.jpg" width="200" height="200" alt="Red round shape" /></a></li>
</ul>
</div>
</asp:Content>
我會用[螢火蟲]啓動(http://getfirebug.com/),看看你可能阻止腳本正確運行的任何異常(如果你的腳本文件實際上被加載) – 2012-02-17 07:12:32