代码正确吗?请检查!!!

来源:2-7 编程练习

慕丝1218524

2020-08-06 17:55:08

<!DOCTYPE html>

<html>

    <head>

        <meta charset="UTF-8">

        <title>location方法</title>

    </head>

    <body>

        <input type="button" value="操作页面" id="ck">

        <script type="text/javascript">

           //补充代码

           var btn=document.getElementById("ck");

           btn.onclick=function(){

               var result=confirm("删除页面么?");

               if(result){

                  location.reload(true); 

               }else{

                   location.replace("http://www.imooc.com");

               }

           }

        </script>

    </body>

</html>


写回答

1回答

好帮手慕码

2020-08-06

同学你好,代码效果正确。继续加油,祝学习愉快~

0

0 学习 · 40143 问题

查看课程