我有編輯操作按鈕,沒有選項「打開新選項卡」時,我右鍵單擊。 這裏是我的代碼:瀏覽器選項在新選項卡中打開鏈接
function actionsTemplateConversion(data) {
if (data != null){
if (canEdit){
row += '<a id="edit" title="${editTr}" onclick="edit(event);"></a>';
}
return row;
}
}
function edit(event) {
table = $('#table').data();
var dataItem = table.dataItem($(event.currentTarget).closest("tr"));
window.location = "users/"+dataItem.id+"/editUser.html?id="+"${id}"+"&name="+"${name}";
}
我已經嘗試使用HREF代替的onclick,並把這個鏈接從編輯()函數href和與我得到的選項打開在右鍵點擊新標籤,但也有這個問題,因爲如果有一個單一的名稱,而不是因爲這個qoutes而引發的所有事情。所以唯一的辦法就是使用這個功能。 我也試過用這個window.location.href但它不工作。 有沒有其他選項可以在window.location旁邊打開鏈接?
[瀏覽器,JavaScript,以便在新標籤window.open(可能的重複https://stackoverflow.com/questions/15818892/chrome-javascript-window-open -in-new-tab) –
我看到了這個,但它不能幫助我,因爲這個解決方案總是在新標籤中打開鏈接。我需要這個選項,以便用戶可以選擇他在哪裏編輯數據 – alonso05