如何创建重试连接按钮? HTML / JS

时间:2017-01-08 11:30:26

标签: javascript html button refresh

问题是如何创建重试与网站连接的按钮。不工作是:

<a href="the page you are currently on">Retry/Refresh</a>

2 个答案:

答案 0 :(得分:1)

尝试version b

documentation

答案 1 :(得分:0)

工作代码应为:

<button onclick="retryConnect()">Retry</button>
<script>
function retryConnect(){
    location="retry.html";
}
</script>

在同一目录中创建一个名为retry.html的文件,并在其中写入:

<p onload="loadPage()">Please wait...</p>

<script>
var delayLoad;

function loadPage() {
    delayLoad = setTimeout(showPage, 1000);
}

function showPage() {
  location="the previous page";
}
</script>