簡單的問題。如何將一個字符串傳遞給一個javascript函數,並生成一個包含該字符串內容的彈出框警報?這裏是我的:將一個字符串傳遞給javascript函數
test.html.erb文件。
<%= link_to 'Test','#', onclick: 'test(helloworld)', class: "btn btn-xs btn-primary" %>
這裏的test.js文件:
function test(name){
alert(name);
}
然而,當我點擊獲取生成的 「測試」 環節, 「HelloWorld」 的不彈出。什麼都沒發生。
完美!謝謝。我知道這很簡單。 – LewlSauce 2014-10-16 18:17:17