匿名函数、window对象confirm、prompt

<script>
    (function(arg) {//匿名函数,没有名字
         alert(arg)
     })('hello,jerry')
</script>
<script>
    //bom对象,浏览器对象模型。使JavaScript有能力与浏览器‘对话’
    window.alert('hello')//window是一个全局变量
    var ret=window.confirm("你来了么")//弹出窗口多出了选择,有确定和取消,有返回值可以被接收
    console.log(ret)//可以获得true或者false
    var msg=window.prompt("请输入留言内容:")//有一个文本框
    console.log(msg)//可以获取输入的内容
</script>

 

posted @ 2018-06-18 17:04  未来的技术  阅读(137)  评论(0编辑  收藏  举报