JS open方法
JS open方法
open()
第一个参数:跳转的url,打开一个新窗口,加在url
第二个参数:字符串,给打开的窗口起一个名字
第三个参数:一串特殊含义的字符串
【注】如果只有一个参数,调用open方法会打开新窗口,加载url
【注】如果已经起好名字,则会在已经起好名字的窗口加载url
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
function btnClick(){
open("https://www.baidu.com","xxx",'width=400,height=400,top=200,left=200,scrollbars=0');
}
</script>
</head>
<body>
<button onclick = "btnClick();">打开窗口</button>
</body>
</html>
运行结果: