看板 Web_Design 關於我們 聯絡資訊
<tr onmouseover="this.style.backgroundColor='#FF0000';"> 這個表格變色語法 要怎麼樣寫成function的形式呢? 我這樣寫結果出現錯誤: <tr onmouseover="color()"> <script> function color(){ this.style.backgroundColor='#FF0000'; } </script> -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.125.41.241
grence:這種寫法也不好;乾脆一次就把 JS跟 HTML切乾淨 10/06 19:50
rocky823:HtmlDOM.onmouseover = function(){xxx} 10/06 19:57
shingoliang:onmouseover="color(this)" 10/06 22:57
opoepev:三樓才是正解 10/06 23:12
Kelunyang:然後function color要改成color(n),原有的this也要改n 10/06 23:41
kalecgos0616:謝謝了 我用3f+5f方法 10/07 10:07