<!DOCTYPE?html>
<html>
<head>
????<title>?new?document?</title>
????<meta?http-equiv="Content-Type"?content="text/html;?charset=gbk"/>
????<script?type="text/javascript">
???????function?openWindow()?{
???????????const?s?=?confirm("是否打開");
???????????if?(s==true)
????????{
????????????const?t?=?prompt("請輸入您要打開的網址:");
????????????window.open(t,'_blank','width=600,height=500,menubar=no,toolbar=no');
????????}
????????else
????????{
????????????return;
????????}
???????}
????</script>
</head>
<body>
<input?type="button"?value="新窗口打開網站"?onclick="openWindow()"?/>
</body>
</html>
2020-01-03
基本功能可以實現了。就是你沒有默認打開網址,還有就是prompt消息對話框,別人點取消也會打開新網站。我這樣寫的,差不多,不過我沒寫else。