<!DOCTYPE html>
<html>
<head>
<title>new document</title>
<meta charset="UTF-8" />
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
<script type="text/javascript">
function openWindow() {
var message = confirm("是否要打开新网站?");
if (message == true) {
var address = prompt("请输入网址");
if (address) {
window.open("http://"+address, "_blank","width=400,height=500,menubar=no,toolbar=no");
}
} else {
alert("已取消");
}
}
</script>
</body>
</html>
输入网址的时候,不需要输入http协议了