Hi
I want to find the color vaule of text which is of different color when user will move mouse on the text/charector.It should display its color value in RGB format.
like
Code: ( text )
<p>Hello Muksh Kumar. Welcome to thescripts.com!
7 1953 gits 5,390
Expert Mod 4TB
hi ...
let me give you an idea to start with:
[HTML]
<script type="text/javascript">
function show_color(event) {
var color = null;
var node = typeof window.event != 'undefined' ?
event.srcElement : event.target;
if (typeof window.getComputedStyle != 'undefined') {
color = window.getComputedStyle(node, '').getPropertyValue('color');
} else if (typeof node.currentStyle != 'undefined') {
color = node.currentStyle.color;
}
alert(color);
}
</script>
<body>
<div onclick="show_color(event);"> test </div>
</body>
[/HTML]
kind regards
hi ...
let me give you an idea to start with:
[HTML]
<script type="text/javascript">
function show_color(event) {
var color = null;
var node = typeof window.event != 'undefined' ?
event.srcElement : event.target;
if (typeof window.getComputedStyle != 'undefined') {
color = window.getComputedStyle(node, '').getPropertyValue('color');
} else if (typeof node.currentStyle != 'undefined') {
color = node.currentStyle.color;
}
alert(color);
}
</script>
<body>
<div onclick="show_color(event);"> test </div>
</body>
[/HTML]
kind regards
Thanks Buddy! you really did a good job. Thanks lot
one more thing from where I can learn more about this topics
gits 5,390
Expert Mod 4TB
no problem ;) ... post back to the forum anytime you have more questions ...
kind regards
Thanks dear
Now if instead of text I use some image then how can I get the value of color of that Image?
gits 5,390
Expert Mod 4TB
i'm sorry ... but i'm quite sure that you cannot do that with javascript since the image is just a included external source and javascript has capabilities to retrieve html, css, js or browser-properties but we have no image-manipulation capabilities ... except retrieveing/setting its dimensions or attributes of the node itself (html-tag) ... but not the src ...
kind regards
i'm sorry ... but i'm quite sure that you cannot do that with javascript since the image is just a included external source and javascript has capabilities to retrieve html, css, js or browser-properties but we have no image-manipulation capabilities ... except retrieveing/setting its dimensions or attributes of the node itself (html-tag) ... but not the src ...
kind regards
Hi
might be you are right but how one can view the RGB value of image when some tool is used in that case also we drag/click the object and corresponding value of the image comes. Might be I asked some foolish thing but there is way to do it.
gits 5,390
Expert Mod 4TB
i remember this thread ... might be you could start from there to more explorations ...
kind regards
Sign in to post your reply or Sign up for a free account.
Similar topics
by: lkrubner |
last post by:
I know I'm missing something obvious, but I looked hard at this page
and did not see the format of the return specified:
http://us3.php.net/manual/en/function.ord.php
>From the limited example...
|
by: Craig Wagner |
last post by:
I have a situation where I have a series of character codes stored in the
database. In some cases they are the ASCII value of the character, in other
cases they are the > 127 character code value...
|
by: Craig Wagner |
last post by:
I have a situation where I have a series of character codes stored in the
database. In some cases they are the ASCII value of the character, in other
cases they are the > 127 character code value...
|
by: farah727rash |
last post by:
Hi all,
I am trying to find the numerical value of a string that stores a two
digit number. I have found the numerical value of a char as:
char character;
cin >character;
int number =...
|
by: Just D |
last post by:
All,
Any valuable idea about subj: "The '%' character, hexadecimal value 0x25" ?
I tried to google, but nothing interesting was found.
Is it IIS settings problem, user side problem or...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |