[JavaScript] JavaScript确认对话框confirm的使用方法演示 →→→→→进入此内容的聊天室

来自 , 2020-07-31, 写在 JavaScript, 查看 107 次.
URL http://www.code666.cn/view/74f23f9e
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <p>Click the button to display a confirm box.</p>
  6.  
  7. <button onclick="myFunction()">Try it</button>
  8.  
  9. <p id="demo"></p>
  10.  
  11. <script>
  12. function myFunction()
  13. {
  14. var x;
  15. var r=confirm("Press a button!");
  16. if (r==true)
  17.   {
  18.   x="You pressed OK!";
  19.   }
  20. else
  21.   {
  22.   x="You pressed Cancel!";
  23.   }
  24. document.getElementById("demo").innerHTML=x;
  25. }
  26. </script>
  27.  
  28. </body>
  29. </html>
  30.  
  31. //javascript/7830

回复 "JavaScript确认对话框confirm的使用方法演示"

这儿你可以回复上面这条便签

captcha