老师帮忙检查一下

来源:2-7 编程练习

慕的地1212123

2020-01-13 18:03:33

<!DOCTYPE html>

<html>

    <head>

        <meta charset="UTF-8">

        <title>location方法</title>

    </head>

    <body>

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

        <script type="text/javascript">

           //补充代码

           var input=document.getElementsByTagName("input")[0],x;

           input.onclick=function(){

            x=window.confirm("确定刷新页面么");

            if(x==true){

            location.reload()

            }else{

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

            }

           }

        </script>

    </body>

</html>

看看有没有需要修改的地方

写回答

1回答

好帮手慕码

2020-01-13

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

0

0 学习 · 40143 问题

查看课程