aaaaurora
2019-01-30 20:24
<!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 reply =confirm("是否打开");
if(reply==true){
var url = prompt("输入要打开的网站","http://www.imooc.com/");
if(url!=""||url!=null){
window.open(url,'_blank','width=400,height=500,menubar=no,toolbar=no');
}else{
alert("请输入网址!");
}
}else{
alert("打开新网站失败!")
}
}
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>
function openWindow(){
var reply =confirm("是否打开");
if(reply==true){
var url = prompt("输入要打开的网站","http://www.imooc.com/");
if(url=="http://www.imooc.com/"){
window.open(url,'_blank','width=400,height=500,menubar=no,toolbar=no');
}else if(url == "" || url == null){
alert("请输入网址!");
}
}else{
alert("打开新网站失败!")
}
}
你这样改一下试试吧
JavaScript入门篇
739817 学习 · 9566 问题
相似问题