
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 = '';
}
}
这段代码是什么意思??? 展开
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 = '';
}
}
这段代码是什么意思??? 展开
2个回答
展开全部
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 = '';
}
}
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 = '';
}
}
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
小样,这都上来问
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询