473,698 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

change color in row

sr
please help
i have problem:
I know how to change color row in table when my mouse is over on this row
and change color to another color when my mouse is out from this row.
but i dont know how to change color when i click on this row and change to
third color and ,this color stay when my mouse is out.please help
Oct 12 '06 #1
6 3948
sr <sr@opgk.koszal in.plwrote:
please help
i have problem:
I know how to change color row in table when my mouse is over on this row
and change color to another color when my mouse is out from this row.
but i dont know how to change color when i click on this row and change to
third color and ,this color stay when my mouse is out.please help
You could call a function on the mouseOut-Event which checks the
background color of the row. And then you can decide what to do:

function colorCheck(obje ct) {

// get background color of object
var bgColor = object.style.ba ckgroundColor;

// if background color is NOT yellow change it to white
if ( bgColor != 'rgb(255, 255, 0)' ) {
object.style.ba ckgroundColor = '#ffffff';
}
}

HTH
../otto
--
http://www.wean.at +++ http://www.lang-kritz.at
:wq
Oct 12 '06 #2
Otto Lang wrote on 12 okt 2006 in comp.lang.javas cript:
var bgColor = object.style.ba ckgroundColor;
if ( bgColor != 'rgb(255, 255, 0)' ) {
<div style='backgrou nd-color:yellow;'
onclick='alert( this.style.back groundColor)'>
xxxxxxxxxxxx</div>

The above in IE6 and FF1.5 will alert: "yellow"

<div style='backgrou nd-color:#f00;'
onclick='alert( this.style.back groundColor)'>
xxxxxxxxxxxx</div>

will in IE 6alert #f00
in FF1.5 rgb(255, 0, 0)
<div style='backgrou nd-color:rgb(255, 255, 0);'
onclick='alert( this.style.back groundColor)'>
xxxxxxxxxxxx</div>

The above in IE6 will alert: "rgb(255,255,0) "
and in FF1.5 will alert: "rgb(255, 255, 0)"
[mind the spaces]

==========

So your test will not be cross browser, and probably not in browser
dependable.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Oct 12 '06 #3
Evertjan. <ex************ **@interxnl.net wrote:
So your test will not be cross browser, and probably not in browser
dependable.
Sorry, such mistakes are not good :( I've forgotten IE and the named
colors. So he will have to make a lot more of tests to get the function
working: And maybe a lot more of tests for Safari and other browsers

../otto
Oct 12 '06 #4
Otto Lang wrote on 12 okt 2006 in comp.lang.javas cript:
Evertjan. <ex************ **@interxnl.net wrote:
>So your test will not be cross browser, and probably not in browser
dependable.

Sorry, such mistakes are not good :( I've forgotten IE and the named
colors. So he will have to make a lot more of tests to get the function
working: And maybe a lot more of tests for Safari and other browsers
What can be done however is this, IE6 and FF1.5 tested:

<style>
..red {background-color:#ff0000;}
..blueish {background-color:#01e;}
</style>

<div class='red'
onclick='alert( (this.className =="red")?"A red color":"Another color")'>
xxxxxxxxxxxx</div>

<div class='blueish'
onclick='alert( (this.className =="red")?"A red color":"Another color")'>
xxxxxxxxxxxx</div>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Oct 12 '06 #5
Evertjan. <ex************ **@interxnl.net wrote:
What can be done however is this, IE6 and FF1.5 tested:

<style>
.red {background-color:#ff0000;}
.blueish {background-color:#01e;}
</style>

<div class='red'
onclick='alert( (this.className =="red")?"A red color":"Another color")'>
xxxxxxxxxxxx</div>

<div class='blueish'
onclick='alert( (this.className =="red")?"A red color":"Another color")'>
xxxxxxxxxxxx</div>
Yes, class names seem to be a good idea. This should also work with
Safari an NetKit-based browsers. I'll test it in the evening when I'm
back at my Mac.

../otto
Oct 12 '06 #6
Evertjan. <ex************ **@interxnl.net wrote:
What can be done however is this, IE6 and FF1.5 tested:

<style>
.red {background-color:#ff0000;}
.blueish {background-color:#01e;}
</style>

<div class='red'
onclick='alert( (this.className =="red")?"A red color":"Another color")'>
xxxxxxxxxxxx</div>

<div class='blueish'
onclick='alert( (this.className =="red")?"A red color":"Another color")'>
xxxxxxxxxxxx</div>
Okay, I tested this option on the Mac with IE 5.2, FF 1.5 and Safari 2
and it works with all of them properly. So I think the OP can use
className to decide how to change the background color.

../otto
Oct 12 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
15206
by: kchengso | last post by:
One of my printers in my printer.devicename call returns in lower case. Is it possible for me to change it to upper case? I am also wondering how, in the first place, this particular printer devicename is coded in lower case? Is there a way to change it back using VB6? Thanks
2
23811
by: Sami | last post by:
I keep getting the famous 'Too Many Connection' Error, and don't know how to change my variables, so they persist even if i have to restart mysql service. Platform: Windows 2003 Server My Program is a WebApplication that is written in VB.Net Using ODBC and OLEDB to connect <- (don't blame me, i just took this over) From what i have read so far, the problem is that i need to change
4
3888
by: J.C. Flores | last post by:
Hello all, First of all, I must state that I'm new to SQL Server, but have been a long-time software guy for quite some time. Please excuse the potential simplicity of the solution to my problem. I create a blank database (TestDB) under my server machine (SQL Server 2000 Standard)... I then create a new table (Run_Number) with only one record in it.
8
9188
by: Patrick Kowalzick | last post by:
Dear NG, I would like to change the allocator of e.g. all std::strings, without changing my code. Is there a portable solution to achieve this? The only nice solution I can think of, would be a namespace and another typedef to basic_string: namespace my_string {
3
8980
by: roger beniot | last post by:
I would like to figure out how to detect an IP address change for an XP/Win2K3 machine that is leasing an IP via DHCP (and do it in C#)... Is there any event that indicates an IP address change?... I really don't want to poll for a change. I would like to get an event indicating the IP address has changed and propogate that change to other levels of my app. If anyone has a solution that isn't in C# I am interested in that as
1
16865
by: Anthony Boudouvas | last post by:
Hi to all, i have a treeview that i put some nodes in it with their repsective images. If i try to change the image and set it to some other ImageList index, nothing happens. The code i use is: private void ChangeServantStatus(string servant, ServantStatus status) {
10
9872
by: Fabrizio | last post by:
(Sorry for the crosspost, but I really don't know which is the right newsgroup!) Hi all, I try to change the password to a user that as to change the password at first logon: try {
5
2932
by: who be dat? | last post by:
Hello all. I'm writing an application that is writing trace information that can be viewed in trace.axd. I would like to rename this and use a different name specific to my application. I know the name of this is set in machine.config. I was hoping it would be possible to change this in web.config. I got it to work, kind of. Good news is I can change the name in my web.config file. Bad news is that trace.axd still works meaning I can...
4
4453
by: active | last post by:
It appears to me that if I change the Control's client size the controls size does not change to agree with the new size. Does it work like the VB6 ScaleWidth and ScaleHeight? That is after I change the Clientsize does the display stay the same but the number of units required to reference a given point changes? Anyway, it appears to me that If I want to change to size of the control so that the client size is some value, I need to...
3
5009
by: Tom | last post by:
I am writing a Visual basic .Net database application. There are many forms that first let you select and look at a DB record and then when you click a "modify" button you are allowed to change data in the text boxes. Then an "update" button saves the data back to the database. What is the best way to change several properties on most of the textbox controls on the form when the "modify" button is clicked? (e.g. make them editible (and...
0
8611
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
9170
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
9031
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
8904
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
8876
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7741
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...
0
5867
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
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...
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.