是否可以将类切换到加载图形并在调用onClick时以及启动location.href之前禁用按钮?有一个延迟,我希望避免双击。有人能告诉我一个这样的样本吗?
<button type="button" class="MoreTides" onclick="location.href='http://www.domain.com/tides/parser_iphone.php?stats=$xml->stationid'">View Graph - Change Dates</button>
答案 0 :(得分:2)
这样的事情可能是一个开始:
<script>
function loadPage(input) {
input.disabled = true;
input.className = "loadingButton"; // define how this should look in CSS
location.href='http://www.domain.com/tides/parser_iphone.php?stats=$xml->stationid';
}
</script>
<button type="button" class="MoreTides" onclick="loadPage(this)">View Graph - Change Dates</button>