2017-04-18 66 views
0

我正在为用户注册创建用于验证电子邮件的电子邮件模板。以下是html代码:html href链接到表单标签下的新页面

<form> 
    <input style="width: 300px; padding: 20px; cursor: pointer; font-weight: bold; background: #141452; color: #ffffff; border-radius: 10px;font-size: 150%;" type="button" 
      value="Verify my email address" onclick="window.location.href='https://www.google.com/'"/> 
    </form> 

我想在新选项卡中打开链接。有谁知道如何在这个代码块中加入“目标”?

谢谢!

+0

这应有助于;) http://stackoverflow.com/questions/19588708/how-to-use-both-onclick-and-target-blank –

+0

你可以试试这个:http://stackoverflow.com/questions/5141910/javascript-location-href-to-open-in-new-window-tab – Vladut

+0

谢谢你们俩! –

回答

2

试试这个:

window.open('http://www.google.com','_blank'); 
+0

谢谢!有用! –