【初识HTML+CSS】JS·Test1:new document
程序员文章站
2022-03-01 21:17:45
...
新窗口的创建
<!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 mywin=confirm("是否创建新窗口?");
var mywin1="新窗口的地址为:";
if(mywin==true){
prompt(mywin1,"https://www.csdn.net/");
window.open('https://www.csdn.net/','_blank','width=400px,height=500px,menubar=no,toolbar=no');
}//对新窗口进行属性设置
else{
window.close();
}
}
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" οnclick="openWindow()" />
</body>
</html>