<script type="text/javascript"> function openWindow(){ var d = confirm("打开新窗口吗?"); if(d==true){ var url = prompt("输入网址:","http://www.imooc.com/"); if(url!=null){ window.open(url,"_blank","width=400,height=500,menubar=on,toolbar=on"); } } } </script>
因为你已经定义过url啊