慕神0416091
2019-05-08 10:27
function openWindow(){
var openw=confirm("是否打开");
var two;
if(openw==true)
{
two=prompt("请输入网址","https://www.imooc.com/");
if(two!=null)
{
window.open(two,'_blank','width=400,height=500')
}
}
}
<!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 msg=confirm("打开窗口?");
if(msg==true){
var b=prompt("输入网址");
if(b=" http://www.imooc.com/"){
window.open('b','widtn=400','heigth=500');
}
else{ window.close();}
}
else{window.close();}
}
</script>
</head>
<body>
<input type="button" value="新窗口打开网站"
JavaScript入门篇
739817 学习 · 9566 问题
相似问题