我想在单击链接时更改链接的文本。我正在使用以下代码,但它不适用于我:
<a id="pp" href="#" title="" onclick="playPause()">play</a>
function playPause(){
if($('.controls li #pp').text() == 'play'){
inter = setInterval(function() {
changeBannerImg(num,1);
}, 4600);
document.getElementById('pp').innerHTML = 'pause';
} else if($('.controls li #pp').text() == 'pause'){
clearInterval(inter);
document.getElementById('pp').innerHTML = 'play';
}
}
function stopAni(){
clearInterval(inter);
document.getElementById('pp').innerHTML = 'play';
}