Click here to Skip to main content
15,895,462 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">


<asp:Image ID="img1" runat="server" ImageUrl="/Sample-Slide/slide/1.jpg" Width="100%" />

<script language="javascript" type="text/javascript">
var i = 1;
function fun() {

i++;
document.getElementById("img1").src = "/Sample-Slide/slide/" + i + ".jpg";
if (i == 5) {
i = 0;
}
}
setInterval("fun()", 4000);
</script>


The above javascript working in properly in a sample webform but not in content page or in master page...

Thnkg you...
Posted

I'm pretty sure that your control ID is not correct (they are updated when working with master page), check these with firebug ;-)
 
Share this answer
 
the image id within content page in javascript should be run time id. run your page and see view page source & pick that id of image & write in code.

it will work for u.
 
Share this answer
 
Comments
srinivas vadepally 22-Jul-13 6:17am    
thnks monika
Use

document.getElementById("<%= img1.ClientID %>").src = "/Sample-Slide/slide/" + i + ".jpg";
 
Share this answer
 

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