<script type="text/javascript">
$(document).ready(function() {
var esta = 0;
function cambiar(){
if ($esta == 0) {
$(".inerr a.next").click();
$esta = 1;
}
else if ($esta == 1){
$(".inerr a.prev").click();
$esta = 0;
}
}
setInterval(cambiar, 5000);
});
</script>
I´m trying to click the a.next or a.prev every 5 secs, for an image change. But i can´t. What is wrong with this?
You instantiate the variable esta
and then checks the variable $esta
try this:
<script type="text/javascript">
$(document).ready(function() {
var $esta = 0;
function cambiar(){
if ($esta == 0) {
$(".inerr a.next").click();
$esta = 1;
}
else if ($esta == 1){
$(".inerr a.prev").click();
$esta = 0;
}
}
setInterval(cambiar, 5000);
});
</script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.