5秒カウントダウンでページをリダイレクトしようとしていますが、ユーザーはcountdwnをキャンセルしてページに留まることができます。ここに私のHTMLはカウントダウンとキャンセルオプションを使用してJavascriptでページをリダイレクト
<form name="redirect">
<center>
<font face="Arial"><b>You will be redirected to the script in<br><br>
<form>
<input type="text" size="3" name="redirect2">
</form>
seconds</b></font>
</center>
。ここではJavaScript
var targetURL="http://javascriptkit.com";
var countdownfrom=10;
var currentsecond=document.redirect.redirect2.value=countdownfrom+1;
function countredirect(){
if (currentsecond!=1){
currentsecond-=1;
document.redirect.redirect2.value=currentsecond;
}
else{
window.location="WWW.google.com";
return;
}
setTimeout("countredirect()",1000)
}
countredirect();
。注:私は実際にポップアップボックスにし、それをやってみたかったキャンセルボタンが
それで、あなたが見つけたその古くて古いコードの問題は何ですか?あなたは問題を解決しようとしましたか? [JavaはJavaScriptではないことに注意してください。それに応じてトピックタグを編集しました。 ]あなたはまだjQueryを持っていません。] –