别比比
2019-01-19 14:51
<!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 mywin=window.open("www.hao123.com");
var pages = confirm("是否打开网页?");
if(pages == true){
window.open('www.hao123.com','_blank','width=400,height=500,menubar=no,toolbar=no');
alert("页面已打开~");
}
else{
mywin.close()
alert("页面已关闭");
}
}
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>
具体的说不太清楚 这是改正的 您参考一下 有错误的话希望理解!
<!DOCTYPE html>
<html>
<head>
<title> new document </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript">
function openWindow()
{
var pages = confirm("是否打开网页?");
if(pages == true){
window.open('https://www.hao123.com/','_blank','width=400,height=500,menubar=no,toolbar=no')
}
else{
var mywin=window.open('https://www.hao123.com/','_blank','width=400,height=500,menubar=no,toolbar=no');
mywin.close()
}
}
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
JavaScript入门篇
739817 学习 · 9566 问题
相似问题