Trying to code a button in HTML that opens a new tab to a website when clicked. However, when it is pressed, it just leads to a white page and nothing happens. Please give advice on what to do
HTML:
<input type="button" value="Save" onclick="editText()">
<script type="text/javascript" src="edit.js"></script>
<!-- This button is supposed to open a new tab to a website -->
<input type="button" value="Run" onclick="open()">
<script type="text/javascsript" src="edit.js"></script>
Javascript (edit.js):
function editText() {
document.getElementById("status").innerHTML = "Saved!"
}
function open() {
window.open("https://www.google.com/?client=safari", _blank)
}
you should pass __blank
as string
window.open("https://www.google.com/?client=safari", '_blank')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.