javascript常用ダイアログセット

4470 ワード

 
  



<br/><script type="text/javascript"> <br>function confirmFun() { <br>//window , <br> <br>// window :confirm(" ?"); <br> <br>// , bool , true, false <br>var b = window.confirm(" ?"); <br>if (b) { <br>alert(" ..."); <br>} else { <br>alert(" ..."); <br>} <br>} <br>// <br> <br>function propmtFun() { <br> <br>// , <br>//propmt( , )// , <br>var re = window.prompt(" ?", " "); <br>while (re != " ") { <br>re = window.prompt(" ?", " "); <br>// propmtFun(); <br>} <br>alert(" ..."); <br>} <br> <br> <br>// <br> <br>function openFun() { <br> <br>// , <br>//window.open( , , ) <br>window.open("demo.htm", "", "top=0,left=0,width=300,height=200,location=no,toolbar=no,menubar=no,status=no"); <br>} <br> <br>// <br>var vs = null; <br>function timeoutFun() { <br>var vf = function () { alert("hello"); }; <br> <br>// <br> <br>// , , <br>vs = setTimeout(vf, 2000); //2000 vf <br>} <br> <br> <br>// <br> <br>function cleartimeoutFun() { <br> <br>// , setTimeout() <br>window.clearTimeout(vs); <br>} <br> <br>// <br>var vi = null; <br>function intervalFun() { <br>var vf = function () { <br>var vt = new Date(); <br> <br>// alert(vt.toLocaleTimeString()); <br> <br>// <br>window.status = vt.toLocaleTimeString(); <br>var text = window.document.getElementById("msg").value = vt.toLocaleTimeString(); <br> <br>}; <br> <br>// vf 1000 <br>vi = window.setInterval(vf, 1000); // 1000 vf <br>} <br> <br>// <br>function clearintervalFun() { <br>window.clearInterval(vi); <br>} <br> <br>// <br>function msgFun() { <br>var str = ""; <br>var vstr = " , ..."; <br>window.document.title = str; <br>window.document.bgColor = "blue"; <br>var i = 1; <br>setInterval(function () { window.document.title = vstr.substr(i, 50); i++; if (i == vstr.length) { i = 0; } }, 500) <br>} <br></script> <br/> <br/> <br/><input type="button" value=" " onclick="confirmFun();"/><br/> <br/><input type="button" value=" " onclick="propmtFun();"/><br/> <br/><input type="button" value=" " onclick="openFun();"/><br/> <br/><input type="text" id="msg"/><br/> <br/><input type="button" value=" " onclick="timeoutFun();"/><br/> <br/><input type="button" value=" " onclick="cleartimeoutFun();"/><br/> <br/><input type="button" value=" " onclick="intervalFun();"/><br/> <br/><input type="button" value=" " onclick="clearintervalFun();"/><br/> <br/><input type="button" value=" " onclick="msgFun();"/><br/> <br/> <br/> <br/> </code></pre> <div class="clearfix"> <span id="art_bot" class="jbTestPos"/> </div> </div> </div> </div>