0
function createResendIVButton(userId, name){
return '<span class=btn onclick=usersTable.resendInvestorVerification("'+userId+'","'+name+'")>resend I.V.</span>';
}
當創建一個元素爲HTML,有可能以某種方式發送函數句柄而不是字符串(函數名稱)?字符串不方便,因爲可見性問題。我需要從HTML創建,因爲我使用的庫不會讓我輕鬆訪問它的DOM,但允許我從HTML代碼初始化行。從HTML創建元素,但通過一個函數作爲句柄
的可能的複製[onClick事件添加到使用document.createElement( 「TH」)](http://stackoverflow.com/questions/11017509/add-onclick-event-to- document-createelementth) – rishipuri
@rishipuri你的引用建議使用'appendChild()',但我只能將HTML代碼發送給某個函數。 – exebook
您是否嘗試過使用'eval()'方法? – quirimmo