好久没来了 问个简单的JS问题- -不触碰太久了

SomethingJack SomethingJack 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
需求.我有一个动态生存的table 需要实现点击一行变色 点击第2行第一行还原 第2行变色 类推。
代码实现了点击变色 但是点击之后无法还原 希望JS高手帮忙改改。
PS: 不能直接在TR中加入客户端事件 按照下面这个 改 谢谢。

function senfe(o, a, b, c)
{
var t = document.getElementById(o)
if (t != null)
{
t = t.getElementsByTagName("tr");
for (var i = 1; i < t.length; i++)
{
var bool = true;
t[i].onclick = function()
{
this.x = "0";
this.style.backgroundColor = (this.sectionRowIndex % 2 == 0) ? a : b;
this.color = "#ffffff";
this.style.cursor = "hand";
}
t[i].onmouseover = function()
{
if (this.x != "1")
this.style.cursor = "hand";
}
}
}
}
...全文

相关推荐

评论 7
收藏 已收藏
分享
返回顶部
SomethingJack
.NET社区 62,274 成员 668,968 内容