打开我输入的网址是http://www.imooc.com/code/www.baidu.com这样的 而不直接就是www.baidu.com
<!DOCTYPE html>
<html>
<head>
<title> new document </title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
<script type="text/javascript">
function openWindow(){
var a=confirm("是否在新窗口打开网页"); // 新窗口打开时弹出确认框,是否打开
if(a==true)
{
var wz=prompt("请输入要打开的网址",);
if(wz!=null) {
window.open(wz,"_blank","width=400,height=500,menubat=0,toolbar=0");
}
else{
window.open(" http://www.imooc.com/","_blank","width=400,height=500,menubat=0,toolbar=0");
}
}
}
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>