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

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


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

オブジェクト1
対象となるWindowオブジェクト
値1
setInterval実行時の戻り値(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_html += ' {s = setInterval("document.write(' + "'●'" + ');", 2000);}' + "\n"; s_html += 'function close_cancel() {clearInterval(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); } //--> </SCRIPT>