try using
$('#<%=adr.ClientID%>').Load.....
in asp.net code, use this id selectors: $("#<%= adr.ClientID %>").Load...;
for server controls as client id may be changed by asp.net infrastructure
Вопрос
I have an adrotator
on my Asp.net Master Page
<asp:AdRotator ID="adr" AdvertisementFile="~/Adrotator.xml" Width="180px" Height="200px"
runat="server" Target="_self" />
I am using the following jquery for rotating ADS . However it is not able to detect the id of the Adrotator control
$(document).ready(function () {
setInterval(function () {
$("[id$='adr']").load(location.href + "[id$='adr']", "" + Math.random() + "");
}, 5000);
});
Note: I already tried using $("[id$='adr']")
and $('[id$=\'adr\']')
and '#adr'
Решение
try using
$('#<%=adr.ClientID%>').Load.....
in asp.net code, use this id selectors: $("#<%= adr.ClientID %>").Load...;
for server controls as client id may be changed by asp.net infrastructure
Другие советы
I would suggest that you check the generated html source of the ad rotator. This could give you more insight into how you should write your jQuery.
Or you may use
<asp:AdRotator ID="adr" AdvertisementFile="~/Adrotator.xml" Width="180px" Height="200px"
runat="server" Target="_self" CssClass="adr" />
and class selector
$(".adr")
Or you may use databind
$("#<%# adr.ClientID %>")
and
Databind();
on page load.