JS之window常见方法(一)
常见的方法
弹出框方法
alert():警告框
prompt():显示可提示用户输入的对话框
1 <script>
2 window.onload = function(){
3 var bt = document.getElementById("bt");
4 bt.onclick = function(){
5 //警告框
6 alert("欢迎");
7 //确认按钮和取消按钮的对话框
8 var result = confirm("登录吗");//返回true和flase
9 alert(result);
10 //显示可提示用户输入的对话框
11 var result2 = prompt("你想我吗?");
12 alert(result2);
13 }
14 }
15 </script>
16 <input type="button" value="点我啊" id="bt" />
浙公网安备 33010602011771号