更新时间:2023-11-13 22:28:34
我很确定您的控件ID不正确(在使用母版页时会更新它们),请使用firebug进行检查; - )
javascript中内容页面中的图像ID应该是运行时间ID。运行你的页面并查看视图页面源并选择图像的id并用代码编写。
它适用于你。
使用
document.getElementById(<%= img1.ClientID%>)。src =/ Sample-Slide / slide /+ i +.jpg;
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:Image ID="img1" runat="server" ImageUrl="/Sample-Slide/slide/1.jpg" Width="100%" /> |
I'm pretty sure that your control ID is not correct (they are updated when working with master page), check these with firebug ;-)
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.
Use
document.getElementById("<%= img1.ClientID %>").src = "/Sample-Slide/slide/" + i + ".jpg";