2017-04-18 55 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

謝謝!有用! –