2011-02-27 6 views
0

내 upload_photo.aspx에 대해 MasterPage를 사용하여 colorBox를 사용하여 파일 업로드 페이지를 표시합니다. 다음은 Asp.net Masterpage 및 ContentPage JavaScript 함수 오류

<%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
    <title></title> 
    <asp:ContentPlaceHolder id="head" runat="server"> 
    </asp:ContentPlaceHolder> 
    <link href="StyleSheet.css" rel="stylesheet" type="text/css" /> 
    <link href="Css/menu_style.css" rel="stylesheet" type="text/css" /> 
    <link href="styles/css/jquery.autocomplete.css" rel="stylesheet" type="text/css" /> 

    <script type="text/javascript" src="http://www.google.com/jsapi"></script> 
    <script type="text/javascript">  google.load('jquery', '1.3.2');</script> 
    <script src="styles/js/jquery.autocomplete.js" type="text/javascript"></script> 
    <script src="styles/js/jquery.dimensions.js" type="text/javascript"></script> 
    <script src="styles/js/jquery.highlight-3.yui.js" type="text/javascript"></script> 


    <script type="text/javascript"> 
     $(function() { 
      $("#txtAutoCompleteSearch").AutoComplete("search.aspx?searchword="); 
     }); 

     function clear_textbox() { 
      if (document.aspnetForm.searchField.value == " Enter Your Search Here ") 
       document.aspnetForm.searchField.value = ""; 
     }; 

    </script> 

</head> 
<body> 
    <form id="masterPageForm" runat="server"> 

    <div id="pagewidth"> 
     <div id="Header"> 
      <asp:Label ID="userName" runat="server" Text="" style=" color: Maroon; font-size: large; z-index: 103; left: 805px; position: absolute; top: 132px"></asp:Label> 
      <asp:LoginStatus ID="LoginStatus1" runat="server" ForeColor="White" 
       LogoutPageUrl="~/Default.aspx" LogoutText="Logout" CssClass="logOut" 
       BackColor="#454545" Font-Bold="True" Font-Names="Arial Black" 
       Font-Size="Small" /> 

      <%--<asp:Image ID="logoHeader" runat="server" CssClass="rounded-corners" ImageUrl="~/img/logo.png"/>--%> 
      <asp:HyperLink ID="hlLogo" runat="server" ImageUrl="~/img/logo.png" NavigateUrl="~/home.aspx"></asp:HyperLink> 

      <%--style="width: 1000px; height: 120px; margin-top: 10px;" />--%> 
      <div style="top: 61px; left: 476px; position: absolute; height: 37px; width: 526px; font-size: medium; font-style: italic; color: #CCFF99; font-weight: bolder; z-index: 103;"> 
       <input id="txtAutoCompleteSearch" name="searchField" class="tb11" type="text" onfocus="clear_textbox()" value=" Enter Your Search Here "/> 
      <asp:ContentPlaceHolder id="Heading" runat="server"> 

      </asp:ContentPlaceHolder> 

      </div> 

     <div class="background"> 
    <asp:menu id="NavigationMenu" CssClass="NavigationMenu" 
     staticdisplaylevels="2" DynamicHorizontalOffset="1" 
     staticsubmenuindent="1px" MaximumDynamicDisplayLevels="4" 
     orientation="Horizontal" 
     DynamicPopOutImageUrl="~/img/right-arrow.gif" 
     StaticPopOutImageUrl="~/img/drop-arrow.gif" 
     datasourceid="MenuSource"  
     runat="server" Height="30px"> 

     <staticmenuitemstyle ItemSpacing="10" CssClass="staticMenuItemStyle"/> 
     <statichoverstyle CssClass="staticHoverStyle" /> 
     <StaticSelectedStyle CssClass="staticMenuItemSelectedStyle"/> 
     <DynamicMenuItemStyle CssClass="dynamicMenuItemStyle" />  
     <dynamichoverstyle CssClass="menuItemMouseOver" /> 
     <DynamicMenuStyle CssClass="menuItem" /> 
     <DynamicSelectedStyle CssClass="menuItemSelected" /> 

     <DataBindings>   
      <asp:MenuItemBinding DataMember="siteMapNode" 
       NavigateUrlField="url" TextField="title" 
        ToolTipField="description" /> 
     </DataBindings> 

     </asp:menu> 
    </div> 

    <asp:TreeView ID="NavigationTreeView" runat="server" Visible="false" DataSourceID="MenuSource" /> 

<div id="e"> 
     <asp:SiteMapPath ID="SiteMapPath1" runat="server" 
       RenderCurrentNodeAsLink="true" 
       CssClass="currentNodeStyle" 
      PathSeparator=" >> " Visible="False"> 
      <PathSeparatorStyle ForeColor="#5D7B9D" CssClass="currentNodeStyle" /> 
      <CurrentNodeStyle ForeColor="#333333" CssClass="currentNodeStyle" /> 
      <NodeStyle ForeColor="#7C6F57" CssClass="currentNodeStyle" /> 
      <RootNodeStyle ForeColor="#5D7B9D" CssClass="currentNodeStyle" /> 
    </asp:SiteMapPath> 
</div>  

    <asp:Panel ID="AccessKeyPanel" runat="server"> 
    </asp:Panel> 
     <asp:SiteMapDataSource id="MenuSource" runat="server" StartFromCurrentNode="false" ShowStartingNode="true" /> 

     <div id="tabDiv"> 
      <asp:ContentPlaceHolder id="mainBody" runat="server"> 

      </asp:ContentPlaceHolder> 
     </div> 

     <div id="footer"> 
      &copy; Copyright Family Photo Online System</div> 
    </div> 
    </div> 
    </form> 

<script type="text/javascript"> 

    function navigateTo(url) { 
     window.location = url; 
    } 

</script> 

</body> 
</html> 

는 자바 스크립트에 대한 upload_photo.aspx 코드 : 아래
<script type="text/javascript"> 
      $(function() { 
       $("#txtAutoCompleteSearch").AutoComplete("search.aspx?searchword="); 
      }); 

      function clear_textbox() { 
       if (document.aspnetForm.searchField.value == " Enter Your Search Here ") 
        document.aspnetForm.searchField.value = ""; 
      }; 

     </script> 

가 mastpage 코드 : 그러나 내가 Masterpage colorBox에 (코드 아래) 추가 된 이후로 표시되지 않습니다 :

<script src="alerts/impromptu/jquery.js" type="text/javascript"></script> 
    <script src="alerts/impromptu/jquery-impromptu.2.6.min.js" type="text/javascript"></script> 
    <link href="alerts/impromptu/impromptu.css" rel="stylesheet" type="text/css" /> 

<link href="colorBox/colorbox.css" rel="stylesheet" type="text/css" /> 
    <script src="colorBox/jquery-1.4.4.min.js" type="text/javascript"></script> 
    <script src="colorBox/jquery.colorbox.js" type="text/javascript"></script> 
    <script type="text/javascript"> 
     $(document).ready(function() { 
      //Examples of how to assign the ColorBox event to elements 
      $("a[rel='example1']").colorbox(); 
      $("a[rel='example2']").colorbox({ transition: "fade" }); 
      $("a[rel='example3']").colorbox({ transition: "none", width: "75%", height: "75%" }); 
      $("a[rel='example4']").colorbox({ slideshow: true }); 
      $(".example5").colorbox(); 
      $(".example6").colorbox({ iframe: true, innerWidth: 425, innerHeight: 344 }); 
      $(".example7").colorbox({ width: "47%", height: "100%", iframe: true }); 
      $(".example8").colorbox({ width: "50%", inline: true, href: "#inline_example1" }); 
      $(".example9").colorbox({ 
       onOpen: function() { alert('onOpen: colorbox is about to open'); }, 
       onLoad: function() { alert('onLoad: colorbox has started to load the targeted content'); }, 
       onComplete: function() { alert('onComplete: colorbox has displayed the loaded content'); }, 
       onCleanup: function() { alert('onCleanup: colorbox has begun the close process'); }, 
       onClosed: function() { alert('onClosed: colorbox has completely closed'); } 
      }); 

      //Example of preserving a JavaScript event for inline calls. 
      $("#click").click(function() { 
       $('#click').css({ "background-color": "#f00", "color": "#fff", "cursor": "inherit" }).text("Open this window again and this message will still be here."); 
       return false; 
      }); 
     }); 
</script> 

방화범 다음 오류 발생 :.

$ ("A [REL = '예제 1']") 컬러 나는 colorBox jQuery를 잘 작동 Masterpage에서 자바 스크립트 기능을 제거하면 상자가 함수 http://localhost:3478/upload_photo.aspx 라인 (19)

없습니다.

누구든지 내가 잘못 가고있는 부분과 어떻게 해결할 수 있는지 조언 해 줄 수 있습니까? 어떤 도움을 주시면 감사하겠습니다.

감사

+0

마스터 페이지와 upload_photo.aspx에 서로 다른 버전의 jquary가 있습니다. 마스터 페이지에 jquary 1.4.4를로드하고 하위 페이지에서 jquary 참조를 제거하십시오. 귀하의 회신을 보내 주셔서 감사합니다 – Damith

답변

3

마스터 페이지 및 사진 페이지에 모두 jQuery를 포함하고 있기 때문에 그것은있을 수 있습니다. 이렇게하면 jQuery가 마스터 페이지에서 스크립트를로드, 초기화 및 실행 한 다음 모든 것을 던지고 다시로드하고 upload_photo.aspx에서 jQuery의 스크립트 태그에 도달하면 모든 것을 다시 초기화합니다. 각 자바 스크립트 라이브러리가 한 번만로드되기를 원합니다. 그렇지 않으면 모든 종류의 혼동이 설정됩니다.

+0

감사합니다. 그래서 이것을하는 가장 좋은 방법은 무엇입니까? 나의 지식 부족에 사과드립니다. – AJsStack

관련 문제