2016-08-05 77 views
1

我在試圖放入身體時遇到郵件鏈接問題。哪裏不對?這封郵件連接有什麼問題?

function mailtogametag(argument) { 
    window.location.href = "mailto:" + "" + "?subject=" + "" + "&body=" 
     newPostKey + "%20Please note the dash is required!"; 
} 

謝謝。

+2

稍微容易一些似乎你缺少一個「+」'附近newPostKey'。 ''參數'從不使用。 – mguimard

+0

請不要發佈縮小的代碼!編輯。 –

+0

什麼是'newPostKey'我沒有看到它的定義和'參數'的目的是什麼我根本沒有看到它被使用。 – NewToJS

回答

2

你錯過"&body="newPostKey之間+標誌:

..+ "?subject=" + "" + "&body=" + newPostKey + "%20Please no... 
________________________________^ 

希望這有助於。

0

如果你支持ES6(或使用巴貝爾),那麼也許可以template strings讓它爲你下一次

function mailtogametag (argument) { 
    window.location.href = `mailto:${''}?subject=${''}&body=${newPostKey}%20Please note the dash is required!`; 
}