Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 03-29-2004, 01:08 AM   #1
LQ Newbie
Registered: Mar 2004
Location: Gujarat, India
Posts: 22

Rep: Reputation: 15
color change on checkbox click

how can i change the backgroud color of tag whenever i click on the checkbox in it.

I mean as soon as the user checks or unchecks the checkbox then the bgcolor of the corresponding
tag should change.

...just as it is done in yahoo mail,
Old 03-29-2004, 12:36 PM   #2
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
I don't use yahoo but why not just look at the source for their page?

You could try something like:
<TITLE>Checkbox Example</TITLE>
<SCRIPT language="javascript" type="text/javascript">
function swapcol(item){
<FORM action="#" name="form">
<DIV id="item1bg">Checkbox 1: <INPUT type="checkbox" id="item1" name="checkbox" onclick="swapcol('item1')"></DIV>
<DIV id="item2bg">Checkbox 2: <INPUT type="checkbox" id="item2" name="checkbox" onclick="swapcol('item2')"></DIV>
<DIV id="item3bg">Checkbox 3: <INPUT type="checkbox" id="item3" name="checkbox" onclick="swapcol('item3')"></DIV>
<DIV id="item4bg">Checkbox 4: <INPUT type="checkbox" id="item4" name="checkbox" onclick="swapcol('item4')"></DIV>
<DIV id="item5bg">Checkbox 5: <INPUT type="checkbox" id="item5" name="checkbox" onclick="swapcol('item5')"></DIV>

Last edited by david_ross; 03-29-2004 at 12:38 PM.
Old 03-29-2004, 11:00 PM   #3
LQ Newbie
Registered: Mar 2004
Location: Gujarat, India
Posts: 22

Original Poster
Rep: Reputation: 15
Thank u very much it worked..


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
change mouse click behaviour nadroj Linux - Newbie 10 01-23-2005 09:25 PM
change color vito_huang Linux - General 1 11-13-2004 01:21 PM
Change Konqueror/Desktop single-click behaviour robertmarkbram Linux - Software 2 10-08-2003 10:58 PM
ls --color 'color change' ekdya Linux - General 1 10-06-2003 03:47 PM
counsol color change crealkillerI75 Slackware 8 07-27-2002 06:36 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:50 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration