[問題] javascript 表格變色寫在function裡
<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
→
10/06 19:50, , 1F
10/06 19:50, 1F
推
10/06 19:57, , 2F
10/06 19:57, 2F
→
10/06 22:57, , 3F
10/06 22:57, 3F
→
10/06 23:12, , 4F
10/06 23:12, 4F
推
10/06 23:41, , 5F
10/06 23:41, 5F
→
10/07 10:07, , 6F
10/07 10:07, 6F
討論串 (同標題文章)
完整討論串 (本文為第 1 之 2 篇):