看板 Ajax 關於我們 聯絡資訊
※ [本文轉錄自 PHP 看板] 作者: FFz (澎湖.仙人掌.234) 站內: PHP 標題: [請益] javascript 指定 function 時間: Sat Feb 24 18:33:22 2007 function func(id){ alert(id); } function modify() { document.getElementById("my2").onclick=func; } <input id="my" type="button" onclick="func(this)" /> <input id="my2" type="button" onclick="modify()" /> 請問一下,這樣 my2 在 click 之後把 onclick 的 function 從 modify 變成了 func 那這樣要怎麼傳遞參數呢? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.104.181.25 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.104.181.25
Fenikso:你的參數要從哪裡生出來? 02/24 19:00
Fenikso:我猜要寫成這樣: 02/24 19:00
Fenikso:onclick=function() {func('aaaa');} 02/24 19:01