点击改变超链接颜色鼠标离开变回原色

将本文档中两种结合JS

https://help.fanruan.com/finereport/doc-view-920.html

setTimeout(function() {$("span.linkspan").bind("click",function() {$(this).css("color", "red");})}, 100); //点击变色

setTimeout(function() {$("span.linkspan").mouseover(function() {$(this).css("color", "red");}) //悬浮变色$("span.linkspan").mouseleave(function() {$(this).css("color", "blue");}) //离开恢复}, 100);

例:

setTimeout(function() {$("span.linkspan").bind("click",function() {$(this).css("color", "red");})}, 100) //点击变色

$("span.linkspan").mouseleave(function() {$(this).css("color", "blue");}) //离开恢复}, 100);

会报错

FineReport 森森森森森 发布于 2023-3-16 14:20 (编辑于 2023-3-16 14:21)
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共1回答
最佳回答
0
luojian0323Lv7资深互助
发布于2023-3-17 08:35

效果:

点击变色,其他行恢复原色.gif

代码:

分页预览,加载结束事件: //contentPane.makeHighlight('red'); //使点击的行变成红色 $(".x-table tr").mousedown(function() { if (this.id !== 'r-0-0') { var row=$(this).attr("tridx") $(".x-table tr").each(function(){ if (this.id !== 'r-0-0') { if(row!=$(this).attr("tridx")){ $(this).children("td").find("span").each(function() { $(this).css("color", 'blue');}); } else{ $(this).children("td").find("span").each(function() { $(this).css("color", 'red');}) }} }); } });

  • 2关注人数
  • 399浏览人数
  • 最后回答于:2023-3-17 08:35
    请选择关闭问题的原因
    确定 取消
    返回顶部