Search code examples
c#jqueryasp.netfacebox

facebox() error object doesnt support this property or method


I have an application that contains this code:

   <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script src="Scripts/facebox.js" type="text/javascript"></script>
    <link href="facebox.css" rel="stylesheet" type="text/css" />
    <script language="Javascript">
        $(document).ready(function () {
            $('a[rel=facebox]').facebox();
        });

</script>
</head>
<body>
    <form id="form1" runat="server">
        <a rel="facebox" href="WebForm1.aspx">Open Facebox Dialog with 0 opacity</a>
    </form>
</body>
</html>

In this one the facebox works very well,
Im applying the same principle in another application in which i render my anchor dynamically :

  link = new HtmlGenericControl("a");
  link.InnerText = Path.GetFileName(value);
  link.Attributes.Add("rel", "facebox");
  link.Attributes.Add("href", "WebForm1.aspx");
  panel.Controls.Add(link);<br/>

and ive got this code on my page

<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
    <script src="js/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="js/facebox.js"></script>
    <link href="css/facebox.css" rel="stylesheet" type="text/css" />
    <script language="Javascript">
        $(document).ready(function () {
            $('a[rel=facebox]').facebox();
        });
    </script>


In this one Im having an error on facebox(). Object doesnt support this property or method.Why m i getting this error although i do have the same code in another application and it works perfectly there ?!?! Thanks alot


Solution

  • I dont know why, but when i put the script tage inside the body it worked