473,804 Members | 2,536 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to get color value of character

254 Contributor
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!
Apr 8 '08 #1
7 1969
gits
5,390 Recognized Expert Moderator Expert
hi ...

let me give you an idea to start with:

[HTML]
<script type="text/javascript">

function show_color(even t) {
var color = null;
var node = typeof window.event != 'undefined' ?
event.srcElemen t : event.target;

if (typeof window.getCompu tedStyle != 'undefined') {
color = window.getCompu tedStyle(node, '').getProperty Value('color');
} else if (typeof node.currentSty le != 'undefined') {
color = node.currentSty le.color;
}

alert(color);
}

</script>

<body>
<div onclick="show_c olor(event);"> test </div>
</body>
[/HTML]
kind regards
Apr 8 '08 #2
mukeshrasm
254 Contributor
hi ...

let me give you an idea to start with:

[HTML]
<script type="text/javascript">

function show_color(even t) {
var color = null;
var node = typeof window.event != 'undefined' ?
event.srcElemen t : event.target;

if (typeof window.getCompu tedStyle != 'undefined') {
color = window.getCompu tedStyle(node, '').getProperty Value('color');
} else if (typeof node.currentSty le != 'undefined') {
color = node.currentSty le.color;
}

alert(color);
}

</script>

<body>
<div onclick="show_c olor(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
Apr 9 '08 #3
gits
5,390 Recognized Expert Moderator Expert
no problem ;) ... post back to the forum anytime you have more questions ...

kind regards
Apr 9 '08 #4
mukeshrasm
254 Contributor
Thanks dear

Now if instead of text I use some image then how can I get the value of color of that Image?
Apr 9 '08 #5
gits
5,390 Recognized Expert Moderator Expert
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
Apr 9 '08 #6
mukeshrasm
254 Contributor
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.
Apr 9 '08 #7
gits
5,390 Recognized Expert Moderator Expert
i remember this thread ... might be you could start from there to more explorations ...

kind regards
Apr 9 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2518
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 I assume it is the decimal (not hex or binary) value of the character being returned? So long as the returned value is between 0 and 127, I can treat it as ascii?
15
9833
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 that you use in combination with the ALT key to enter special characters into a document (e.g. ALT+0147 and ALT+0148 get you 'smart quotes'). I'm trying to figure out how (or if it's possible) to obtain the Unicode equivalent of the character...
0
1008
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 that you use in combination with the ALT key to enter special characters into a document (e.g. ALT+0147 and ALT+0148 get you 'smart quotes'). I'm trying to figure out how (or if it's possible) to obtain the Unicode equivalent of the character...
8
2258
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 = character - 48; // Computing the numberical value of character entered cout << "The number you entered is: " << number << endl << endl;
5
11663
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 whatever? We receive it regularly and I guess the problem is not in our source codes. Please help! Just D.
0
9711
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9591
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10594
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10343
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10331
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9166
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7631
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5529
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.