在悬停时更改背景颜色或选择 [英] change background color on hover or select

查看:102
本文介绍了在悬停时更改背景颜色或选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表格,其中包含一个由几个复选框组成的表格,我是

想知道是否可以更改表格行背景颜色

mouseover或hover当选中该行中的复选框

时,让它保持这种颜色?

Poko

I have a table with a form consisting of several checkboxes and I''m
wondering if its possible to change the table row background color on
mouseover or hover and make it stay that color when the checkbox in that row
is selected?
Poko

推荐答案

Gary在2005年9月25日凌晨3:18发表以下内容:
Gary said the following on 9/25/2005 3:18 AM:
我有一个表格,其中包含一个由几个复选框组成的表格,我想知道它是否可能更改鼠标悬停或悬停时的表格行背景颜色,并选择该行中的复选框
时保持该颜色?
I have a table with a form consisting of several checkboxes and I''m
wondering if its possible to change the table row background color on
mouseover or hover and make it stay that color when the checkbox in that row
is selected?




是的,实际上非常可能而且非常简单。搜索档案,

给你最好的尝试,然后用你的

努力回复一些代码和/或URL。或者,你是否希望有人从头开始写整篇文章?


-

兰迪

comp.lang.javascript常见问题 - http://jibbering.com/faq &新闻组周刊



Yes, it is very possible and quite simple actually. Search the archives,
give it your best try, and post back with some code and/or a URL to your
efforts. Or, did you expect someone to write the entire thing from scratch?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly


Randy Webb写道:
Randy Webb wrote:
Gary在9/25/2005 3:18 AM说了以下内容:
Gary said the following on 9/25/2005 3:18 AM:
我有一个表格,其中包含一个由几个复选框组成的表格,我想知道是否可以在鼠标悬停或悬停时更改表格行背景颜色,并使其在复选框时保持该颜色在
中选择了哪一行?
I have a table with a form consisting of several checkboxes and I''m
wondering if its possible to change the table row background color on
mouseover or hover and make it stay that color when the checkbox in
that row is selected?



是的,实际上非常可能而且非常简单。搜索
档案,给你最好的尝试,然后回复一些代码和/或
你的努力的URL。或者,你是否希望有人从头开始编写整个
的东西?



Yes, it is very possible and quite simple actually. Search the
archives, give it your best try, and post back with some code and/or
a URL to your efforts. Or, did you expect someone to write the entire
thing from scratch?




:)点了,谢谢你的回复Randy

poko



:) Point taken, thank you for your response Randy
poko


Garyaécrit:
Gary a écrit :
我有一个表格,表格由几个复选框组成,我是
想知道是否有可能在鼠标悬停或悬停时更改表格行背景颜色,并在选中该行中的复选框时使其保持该颜色?
Poko
I have a table with a form consisting of several checkboxes and I''m
wondering if its possible to change the table row background color on
mouseover or hover and make it stay that color when the checkbox in that row
is selected?
Poko




不,你有一个包含表格的表格

(表格不能包含表格)

(表格可以包含元素(b)表格:
http://perso.wanadoo.fr/stephane.mor...ht_rows_en.htm

< html>< form>< table border = 1 cellspacing = 0>

< tr>

< td >

< input type = checkbox onclick =" highLght(this)">

< / td>

< ; td> blah< / td>< td> blah< / td>< td> blah< / td>

< / tr>

< tr> ;

< td>

< input type = checkbox onclick =" highLght(this)">

< / td>

< td> blah< / td>< td> blah< / td>< td> blah< / td>

< / tr>

< / table>< / form>

< script type =" text / javascript">

function highLght( chckbox){

var rw = chckbox.parentNode.parentNode;

rw.className =(chckbox.checked)? ''backCol'':'''';

}

< / script>

< style type =" text / css">

..backCol {background-color:yellow}

< / style>

< / html>

-

Stephane Moriaux et son [moins] vieux Mac



No, you have a form containing a table
(table can''t contain a form)
(table can contain elements of a form)

see that :
http://perso.wanadoo.fr/stephane.mor...ht_rows_en.htm
<html><form><table border=1 cellspacing=0>
<tr>
<td>
<input type=checkbox onclick="highLght(this)">
</td>
<td>blah</td><td>blah</td><td>blah</td>
</tr>
<tr>
<td>
<input type=checkbox onclick="highLght(this)">
</td>
<td>blah</td><td>blah</td><td>blah</td>
</tr>
</table></form>
<script type="text/javascript">
function highLght(chckbox) {
var rw = chckbox.parentNode.parentNode;
rw.className = (chckbox.checked)? ''backCol'' : '''';
}
</script>
<style type="text/css">
..backCol { background-color: yellow }
</style>
</html>
--
Stephane Moriaux et son [moins] vieux Mac


这篇关于在悬停时更改背景颜色或选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆