【发布时间】:2021-12-06 12:51:19
【问题描述】:
我正在制作一个扩展程序,我想知道如何制作一个在新窗口中打开 URL 的按钮?
这是我现在拥有的,但并不多,我只是从 HTML 开始
<head>
<style type="text/css">
body {
width: 380px;
height: 550px;
overflow: hidden;
background-image: url('Background Image');
}
</style>
</head>
<body>
<center>
<h1 style="color:white">Headline</h1>
</center>
</body>
<body>
<button onclick=href='https://url.com'type="button">
Link
</button>
<script>
function ClickButton() {
}
</script>
</body>
</html>```
【问题讨论】:
-
请注意
<center>已过时,不应使用 -
为什么不使用 target="_blank" 作为链接而不是按钮的属性?
标签: javascript html