-1

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

Grace
  • 1,265
  • 21
  • 47

2 Answers2

0

And, is the path js/facebox.js exists inside the page location?

Remember that the link to the js file will be relative to the current page location since you are not providing ab absolute path to the file and probabliy you are using a page in a diferent location from the Master.Page of the site root .

Nuno Agapito
  • 220
  • 3
  • 12
  • Since you get undefined in firebug the most obvious problem is the files not loading. On Firebug, go to the Net tab and reload page and see if some request fails. – Nuno Agapito Jun 21 '11 at 13:36
  • I think i know what the problem is but i cant figure out how to fix it..my page extends from a class .cs in which i load my js files. so when im putting my facebox.js file either in my page or in the cs file.. it cant find it – Grace Jun 22 '11 at 09:01
0

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

Grace
  • 1,265
  • 21
  • 47