Loose-Info.com
Last Update 2009/03/29
TOP - JavaScript - Window - clearTimeout()

setTimeout()のコード実行の設定を解除します。


オブジェクト1 .clearTimeout( 値1 )

オブジェクト1
対象となるWindowオブジェクト
値1
setTimeout実行時の戻り値(id)


(例)

<SCRIPT type="text/javascript"> <!-- function btnclick() { var w1 = window.open("", "", "height=150,width=240"); w1.moveTo(200,200); var s_html = ""; s_html += "<html>\n"; s_html += "<body>\n"; s_html += '<script type="text/javascript">' + "\n"; s_html += "<!--\n"; s_html += "var s;\n"; s_html += 'function close_start() {s = setTimeout("close()", 2000);}' + "\n"; s_html += 'function close_cancel() {clearTimeout(s);}' + "\n"; s_html += "\/\/-->\n"; s_html += "<\/script>\n"; s_html += '<input type="button" value="押すと2秒後に閉じます"'; s_html += ' onclick="close_start()"><br>' + "\n"; s_html += '<input type="button" value="閉じるのをキャンセルします"'; s_html += ' onclick="close_cancel()"><br>' + "\n"; s_html += "</body>\n"; s_html += "</html>\n"; w1.document.write(s_html); w1.document.close(); } //--> </SCRIPT>