Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Friends, I am using timer control at master page to show time and is working fine in content pages. But when I write java script function in the content page, it is not working. Code details of the content page have been pasted for solution from all of you.
ASP.NET
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
 <script language="javascript">
        $(function PageLoad() {
            var $ds = $("div.s_show");
            $ds.hide().eq(0).show();
            var pcnt = $ds.length;
            setInterval(p_slider, 3000);
            function p_slider() {
                $ds.eq(($ds.length++) % pcnt)
                  .slideUp("slow", function () {
                      $ds.eq(($ds.length) % pcnt)
           .slideDown("slow");
                  });
            }
        });
    </script>


XML
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

 <div>
 <asp:Panel ID="p1" runat="server" ClientIDMode="Static" class='s_show' BackColor="#CC3399"
        BorderColor="#FF6699" BorderStyle="Groove" BorderWidth="5px" Width="300px">
Hiiiiiiii It's Panel One Good Day!!!!!
<asp:Image ID="Image1" runat="server" ImageUrl="~/Images/Image2.jpg" Width="300"></asp:Image>
</asp:Panel>
<asp:Panel ID="p2" runat="server" ClientIDMode="Static" class='s_show' BackColor="#9999FF"
        BorderColor="#006666" BorderStyle="Groove" BorderWidth="5px" Width="300px">
Hiiiiiiiii It's Panel Two Good Luck!!!!
<asp:Image ID="Image2" runat="server" ImageUrl="~/Images/Image1.jpg" Width="300px"></asp:Image>
</asp:Panel>



Waiting for quick response, thank you friends....
Posted
Updated 13-May-12 1:02am
v2
Comments
Dhanamanikandan 13-May-12 7:37am    
Do u want to run this JS code on load function?
Brajabas 13-May-12 10:50am    
Sorry for late response. Yaa, I need to run this JS code on load. The timer at the master page runs ok, but this JS function does not run on the content page.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900