javascript - 尝试使用 window.open 在 HTML 中打开一个新窗口不起作用
问题描述
当我按下按钮时,我试图打开一个新窗口,但我的代码不起作用。我收到错误“参数列表后未捕获的语法错误:缺少)”。我找不到我做错了什么
<HTML>
<body>
<button id="open_window" onclick="window.open(https://www.google.com, height=570, width=520);"></button>
<style>
#open_window{
position: fixed;
width: 15%;
height: 15%;
left: 35%;
top: 35%;
}
</style>
</body>
</HTML>
解决方案
网址应该被引用
<button id="open_window" onclick="window.open('https://www.google.com', height=570, width=520);"></button>
推荐阅读
- javascript - 如何将循环迭代中的特定变量值附加到一个动态创建的元素
- sql - 如何使用 CMD(SQLCMD)执行 file.sql(脚本)并将结果保存在我的计算机中的文件中?
- python - 无法从一个目录上导入包
- php - 升级到 PHP 7.3 后的 CodeIgniter 问题
- c# - 访问最近文件中显示的文件目录
- mysql - SQL 存储函数有问题,返回错误
- go - 带有 CRUD 操作的 RW 锁
- r - 保留滞后价值以复合最终价值
- neo4j - 在 Neo4jClient 的 Where 子句中使用距离方法
- google-apps-script - 有没有办法使用特定脚本生成所有谷歌表格的列表?