var color = "";
var trNodes = document.querySelectorAll('tbody tr');
for (var index = 1; index < trNodes.length; index++) {
trNodes[index].onmouseover = function () {
color = this.children[0].style.backgroundColor;
for(j=0;j<this.children.length;j++)
{
this.children[j].style.backgroundColor='yellow';
};}
trNodes[index].onmouseout = function () {
for(j=0;j<this.children.length;j++)
{
this.children[j].style.backgroundColor=color;
};} }
55 评论
为何我后面的单元格隐藏了,但是鼠标悬浮到那一行隐藏了的单元格也会变色啊
赞 1 2023-11-28 15:53
10.0版本报错
CustomJSError : _g(...).addEffect is not a function
赞 1 2023-08-26 14:17
解决了吗
赞 0 2024-01-12 12:00
鼠标悬浮行变色,当鼠标经过有链接的单元格时,无法实现行变色。
赞 0 2023-06-27 08:31
悬浮或点击行变色的JS脚本只试用版本11吗?版本10怎么实现悬浮行变色呢?
赞 0 2023-05-06 10:06
鼠标悬浮行变色离开时恢复 ,也是仅仅支持cpt的分页预览模式吗?分析预览模式支持吗?
赞 0 2023-02-06 11:36
支持的,在数据分析预览设置加载结束事件即可
赞 0 2023-02-10 16:00
而且鼠标移动到所谓的标题行也会生效,这样标题行就是所谓的列名称字体、颜色、大小都会跟着变化;那标题行跟下面列表内容的字体、颜色、大小都不一样呢?这个怎么处理?
赞 0 2023-02-17 17:25
var color = "";
var trNodes = document.querySelectorAll('tbody tr');
for (var index = 1; index < trNodes.length; index++) {
trNodes[index].onmouseover = function () {
color = this.children[0].style.backgroundColor;
for(j=0;j<this.children.length;j++)
{
this.children[j].style.backgroundColor='yellow';
};}
trNodes[index].onmouseout = function () {
for(j=0;j<this.children.length;j++)
{
this.children[j].style.backgroundColor=color;
};} }
赞 2 2023-07-31 14:12
你好,为表头单独设置样式就不会对标题行生效了~
赞 0 2023-06-01 10:38
这个代码不能直接执行,会报错!
赞 0 2023-02-17 17:22
你好,本地并未复现您的情况,您可以前往问答区上传模板/日志/具体现象提问,这样便于更好的解答您的问题。
问答地址:https://bbs.fanruan.com/wenda
赞 0 2023-05-19 16:24