鼠标悬停时亮/彩色反转 [英] Brighter / color inversion on mouse over
问题描述
大家好,
我有一个难题:)我有以下情况:
< span onmouseover =" SelectionEffect()">
< div style =" width:50px;身高:50px;
背景颜色:#FFE4E1">< / div>
< / span>
我该怎么办?代码SelectionEffect(),当鼠标悬停在
范围内时,div的背景颜色会变得更加鲜艳,无论颜色是什么颜色
是什么?
>
或者甚至是跨越
的颜色反转(不是R,不是B,而不是G)(我想要一个感觉他正在移动某个区域)。
-Pam
Hi guys,
I have a hard problem :) I have the following situation:
<span onmouseover = "SelectionEffect()">
<div style="width: 50px; height: 50px;
background-color:#FFE4E1"></div>
</span>
How can I code SelectionEffect() to have that when the mouse hover the
span the background color of the div becomes brigher, whatever color it
is?
Or perhaps even a color inversion (not R, not B, not G) within the span
would do (I want one "feels" he is moving over some area).
-Pam
推荐答案
于2006年8月24日在comp.lang.javascript上写道 :
wrote on 24 aug 2006 in comp.lang.javascript:
我有一个难题:)我有以下情况:
< ; span onmouseover =" SelectionEffect()">
< div style =" width:50px;身高:50px;
背景颜色:#FFE4E1">< / div>
< / span>
我如何编码SelectionEffect()以便当鼠标悬停在
范围内时,div的背景颜色变得更加鲜明,无论它的颜色是什么?
是什么?
I have a hard problem :) I have the following situation:
<span onmouseover = "SelectionEffect()">
<div style="width: 50px; height: 50px;
background-color:#FFE4E1"></div>
</span>
How can I code SelectionEffect() to have that when the mouse hover the
span the background color of the div becomes brigher, whatever color it
is?
无需在你的div周围放置一个范围。
< div
onmouseover =" this.style.backgroundColor =''#fff''"
onmouseout =" this.style.backgroundColor =''#ffe4e1''"
style =" width:50px; height:50px; background-color:#ffe4e1">
内容
< / div>
-
Evertjan。
荷兰。
(请将x''es更改为我的电子邮件地址中的点数)
No need to put a span around your div.
<div
onmouseover = "this.style.backgroundColor=''#fff''"
onmouseout = "this.style.backgroundColor=''#ffe4e1''"
style="width:50px;height:50px;background-color:#ffe4e1">
Content
</div>
--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)
Evertjan。 ha scritto:
Evertjan. ha scritto:
< div
onmouseover =" this.style.backgroundColor =''#fff''"
onmouseout =" this.style.backgroundColor =''#ffe4e1''"
style =" width:50px; height:50px; background-color:#ffe4e1" ;>
内容
< / div>
<div
onmouseover = "this.style.backgroundColor=''#fff''"
onmouseout = "this.style.backgroundColor=''#ffe4e1''"
style="width:50px;height:50px;background-color:#ffe4e1">
Content
</div>
谢谢Evertjan。但是我需要一个有效的解决方案*无论是什么颜色它都是*,而不是给定的特定颜色。
我正在考虑的单元格可以是*任何*颜色,我需要一个功能
工作
无论颜色是什么。因此processimg必须涉及跨度内使用的
背景颜色。这就是为什么我是
建议对RGB组件进行简单的颜色反转,虽然我不知道怎么用javascript写的怎么写。
Thanks Evertjan. But I need a solution that work *whatever color it
is*, and not for a given specific color.
The cells I am considering can be of *any* color and I need a function
that works
whatever color it is. So the processimg must necessarily involve the
background color that is used within the span. That''s why I was
suggesting a simple color inversion on the RGB components, althought I
do not know how to write in javascript :)
无需在你的div周围放置一个跨度。
No need to put a span around your div.
我知道。这是我的情况的极端简化。我需要它
因为
我控制了几个附加到它的事件,并且
跨越了几个DIV。
-Pam
I know. It''s an extreme simplification of my situation. I need it
because
there are several events attached to it that I am controlling, and
several DIVs within the Span.
-Pam
-
Evertjan。
荷兰。
(请在我的电子邮件地址中将x'变为点数)
--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)
pa *********** @ libero.it 写道:
pa***********@libero.it wrote:
我有一个难题:)我有以下情况:
< span onmouseover =" SelectionEffect()">
< div style =" width:50px;身高:50px;
I have a hard problem :) I have the following situation:
<span onmouseover = "SelectionEffect()">
<div style="width: 50px; height: 50px;
跨度元素不能包含HTML中的div元素。您可能需要
访问 http://validator.w3。 org /
我如何编码SelectionEffect()以便在鼠标悬停时使用
跨越背景颜色div变得更加鲜艳,无论它是什么颜色?b $ b是多少?
How can I code SelectionEffect() to have that when the mouse hover the
span the background color of the div becomes brigher, whatever color it
is?
你需要循环遍历元素(getElementsByTagName(*)),找到
他们的背景颜色(计算样式) ,改变每个
算法的值,然后用.style.backgroundColor属性设置它。
You''d need to loop over the elements (getElementsByTagName(*)), find
their background colour (in computed style), alter the value per some
algorithum and then set it with the .style.backgroundColor property.
这篇关于鼠标悬停时亮/彩色反转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!