prompt中输入别的网址,怎么实现打开?
<!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 mymessage=confirm("请问是否打开新网站?") ;
if(mymessage==true)
{var mychar=prompt("请输入网址:"," http://www.imooc.com/");
if(mychar!=null)
{ window.open("http://www.imooc.com","-blank","width=600px,height=400px,top=100px,left=100px")
}
else
{}
}
else
{
}
}
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>