2017-02-26 47 views
-1

我正在用java腳本製作一個小型web應用程序,它是一個創建書籤和保存網站的簡單應用程序。我製作了這個網絡應用程序,因此它可以保存到網站的鏈接,但我不知道如何使這個鏈接可點擊,然後讓它們打開,然後在新的瀏覽器窗口中點擊鏈接。如何在JavaScript和HTML中單擊鏈接時打開一個新窗口?

這是我的代碼:

<form class="ui stacked segment form" action="/bookmark/{{bookmark.id}}/addwebsite" method="POST"> 
    <div class="two fields"> 
    <div class="field"> 
     <label>Title</label> 
     <input placeholder="Title" type="text" name="title"> 
    </div> 
    <div class="field"> 
     <label>Link</label> 
     <input placeholder="Link" type="link" name="link"> 
    </div> 
    <div class="field"> 
     <label>Summary</label> 
     <input placeholder="Summary" type="text" name="summary"> 
    </div> 
    </div> 
    <button class="ui blue submit button">Add Website</button> 
</form> 

////////////////////////////////// ///////////////////////

<table class="ui table"> 
    <thead> 
    <tr> 
     <th>Website</th> 
     <th>Link</th> 
     <th>Summary</th> 
     <th></th> 
    </tr> 
    </thead> 
    <tbody> 
    {{#each bookmark.websites}} 
     <tr> 
     <td> 
      {{title}} 
     </td> 
     <td> 
      {{link}} 
     </td> 
     <td> 
      {{summary}} 
     </td> 
     <td> 
      <a href="/bookmark/{{../bookmark.id}}/deletewebsite/{{id}}" class="ui icon button"> 
      <i class="icon trash"></i> 
      </a> 
     </td> 
     </tr> 
    {{/each}} 
    </tbody> 
</table> 
+0

問題爲什麼不鏈接可以點擊的,因爲它已經是?問題的第一部分沒有意義 – charlietfl

回答

1

target="_blank"屬性添加到您的定位標記。這將在新標籤中打開鏈接。

1

使用target="_blank"會爲你解決

<a href="http://www.google.com" target="_blank">Click Here</a> 
0

添加target="blank"這樣

<a href="/bookmark/{{../bookmark.id}}/deletewebsite/{{id}}" target="blank" class="ui icon button">click</a> 
相關問題