Table中鼠标划过一行时,整行变色

functionoverIt(){varthe_obj=event.srcElement;if(the_obj.tagName.toLowerCase()=="td"){... function overIt() {
var the_obj = event.srcElement;
if (the_obj.tagName.toLowerCase() == "td") {
the_obj = the_obj.parentElement;
the_obj.oBgc = the_obj.currentStyle.backgroundColor; the_obj.oFc = the_obj.currentStyle.color;
the_obj.style.backgroundColor = 'red';
the_obj.style.color = 'red';
the_obj.style.textDecoration = 'underline';
}
}

function outIt() {
var the_obj = event.srcElement;
if (the_obj.tagName.toLowerCase() == "td") {
the_obj = the_obj.parentElement;
the_obj.style.backgroundColor = the_obj.oBgc;
the_obj.style.color = the_obj.oFc;
the_obj.style.textDecoration = '';
}
}
这段代码是什么意思???
展开
 我来答
百度网友3c3af2d
推荐于2016-02-27 · TA获得超过292个赞
知道小有建树答主
回答量:196
采纳率:0%
帮助的人:166万
展开全部
function overIt() 移入显示的样式

function overIt() {
var the_obj = event.srcElement;//获取当前鼠标移上去获取的元素
if (the_obj.tagName.toLowerCase() == "td") { //如果这个元素是td
the_obj = the_obj.parentElement;// 获取td的父类 就是tr
the_obj.oBgc = the_obj.currentStyle.backgroundColor; //获取tr的 背景颜色 赋给动态属性obgc (注:currentStyle 只能获取Ie下的非行间的样式 ff下用getComputedStyle)
the_obj.oFc = the_obj.currentStyle.color;//获取tr的字体颜色 赋给 动态属性ofc
the_obj.style.backgroundColor = 'red'; //设置tr的背景颜色
the_obj.style.color = 'red'; //设置tr的字体颜色
the_obj.style.textDecoration = 'underline'; //让tr有下划线
}
}

function outIt() 移除显示的样式

function outIt() {
var the_obj = event.srcElement; //获取当前鼠标移上去获取的元素
if (the_obj.tagName.toLowerCase() == "td") { //如果这个元素是td
the_obj = the_obj.parentElement;// 获取td的父类 就是tr
the_obj.style.backgroundColor = the_obj.oBgc; //让tr 回到原始的样式(就是当初移上去保存动态属性的 obgc 的颜色) 下同
the_obj.style.color = the_obj.oFc;
the_obj.style.textDecoration = '';
}
}
本回答被提问者和网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
任潇潇7089
2013-08-11 · TA获得超过1336个赞
知道小有建树答主
回答量:327
采纳率:0%
帮助的人:264万
展开全部
小样,这都上来问
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式