开发者

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 opa开发者_JS百科city</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


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 .


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜