|
 |
asp_databases thread: Re: Change the bgcolor of a row dynamically
Message #1 by "VAN BUTSEL ANDRE" <avanbutsel@b...> on Tue, 30 Apr 2002 00:16:13 +0200
|
|
Try this:
<html>
<head>
<title>checkboxcolor2</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE="JavaScript">
function inspectbox(){
for (var i = 1; i <= 5; i++){
if (document.form1.check[i].checked){
document.all.row[i].bgColor = "70DB93"}
else {
document.all.row[i].bgColor = "FFFFFF"}
}
}
</SCRIPT>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="">
<table width="50%" border="0" cellspacing="2">
<tr ID="row1">
<td width="12%">
<input type="checkbox" name="check1" value="checkbox"
onClick="inspectbox()">
</td>
<td width="88%">checkbox1</td>
</tr>
<tr ID="row2">
<td width="12%">
<input type="checkbox" name="check2" value="checkbox"
onClick="inspectbox()">
</td>
<td width="88%">checkbox2</td>
</tr>
<tr ID="row3">
<td width="12%">
<input type="checkbox" name="check3" value="checkbox"
onClick="inspectbox()">
</td>
<td width="88%">checkbox3</td>
</tr>
<tr ID="row4">
<td width="12%">
<input type="checkbox" name="check4" value="checkbox"
onClick="inspectbox()">
</td>
<td width="88%">checkbox4</td>
</tr>
<tr ID="row5">
<td width="12%">
<input type="checkbox" name="check5" value="checkbox"
onClick="inspectbox()">
</td>
<td width="88%">checkbox5</td>
</tr>
</table>
</form>
</body>
</html>
----- Oorspronkelijk bericht -----
Van: "Aftab Ahmad" <aftab.ahmad@k...>
Aan: "ASP Databases" <asp_databases@p...>
Verzonden: maandag 29 april 2002 15:30
Onderwerp: [asp_databases] Change the bgcolor of a row dynamically
> I want to change the background color of a row when I checked the checkbox
> against that particular row using JavaScript (just as it works in hotmail
> when one check the mail to delete).
>
> Thanks in advance
>
> Aftab
>
>
Message #2 by Aftab Ahmad <aftab.ahmad@k...> on Mon, 29 Apr 2002 15:30:56 +0200
|
|
I want to change the background color of a row when I checked the checkbox
against that particular row using JavaScript (just as it works in hotmail
when one check the mail to delete).
Thanks in advance
Aftab
Message #3 by "Drew, Ron" <RDrew@B...> on Mon, 29 Apr 2002 09:56:58 -0400
|
|
Cut and Paste what u want.
<HEAD>
<SCRIPT LANGUAGE=3D"JavaScript">
<!-- Begin
function colorChange() {
no =3D document.form.colors.selectedIndex
document.bgColor =3D document.form.colors.options[no].value
document.form.hex.value =3D " use <body bgcolor=3D\"#" +
document.form.colors.options[no].value + "\"> ";
}
</SCRIPT>
<BODY>
<FORM NAME=3D"form">
<TABLE BORDER=3D2 CELLSPACING=3D0 CELLPADDING=3D0
BGCOLOR=3Dwhite><TR><TD>
<SELECT NAME=3D"colors" onChange=3D"colorChange()">
<OPTION VALUE=3D"FFFFFF" SELECTED>Pick a color!
<OPTION VALUE=3D"70DB93">Aquamarine
<OPTION VALUE=3D"000000">Black
<OPTION VALUE=3D"0000FF">Blue
<OPTION VALUE=3D"A67D3D">Bronze
<OPTION VALUE=3D"B87333">Copper
<OPTION VALUE=3D"00FFFF">Cyan
<OPTION VALUE=3D"2F4F2F">Dark Green
<OPTION VALUE=3D"871F78">Dark Purple
<OPTION VALUE=3D"545454">Dim Gray
<OPTION VALUE=3D"D19275">Feldspar
<OPTION VALUE=3D"FF8040">Flesh
<OPTION VALUE=3D"CD7F32">Gold
<OPTION VALUE=3D"C1C1C1">Gray
<OPTION VALUE=3D"00FF00">Green
<OPTION VALUE=3D"93DB70">Green-Yellow
<OPTION VALUE=3D"D98719">Honey
<OPTION VALUE=3D"215E21">Hunter Green
<OPTION VALUE=3D"7F00FF">Indego
<OPTION VALUE=3D"9F9F5F">Khaki
<OPTION VALUE=3D"8F8FBD">Light Sky Blue
<OPTION VALUE=3D"E6E8FA">Light Silver
<OPTION VALUE=3D"32CD32">Lime
<OPTION VALUE=3D"800000">Maroon
<OPTION VALUE=3D"856363">Milk Chocolate
<OPTION VALUE=3D"4D4DFF">Neon
<OPTION VALUE=3D"FF7F00">Orange
<OPTION VALUE=3D"E9C2A6">Peach
<OPTION VALUE=3D"FF1CAE">Pink
<OPTION VALUE=3D"FF0000">Red
<OPTION VALUE=3D"8C1717">Scarlet
<OPTION VALUE=3D"007FFF">Slate Blue
<OPTION VALUE=3D"CFB53B">Tainted Gold
<OPTION VALUE=3D"DB9370">Tan
<OPTION VALUE=3D"4F2F4F">Violet
<OPTION VALUE=3D"FFFFFF">White
<OPTION VALUE=3D"FFFF00">Yellow
</SELECT>
<INPUT TYPE=3D"text" NAME=3D"hex" VALUE=3D"<--- Pick a color!"
SIZE=3D30></TD></TR>
</TABLE>
</FORM>
-----Original Message-----
From: Aftab Ahmad [mailto:aftab.ahmad@k...]
Sent: Monday, April 29, 2002 9:31 AM
To: ASP Databases
Subject: [asp_databases] Change the bgcolor of a row dynamically
I want to change the background color of a row when I checked the
checkbox against that particular row using JavaScript (just as it works
in hotmail when one check the mail to delete).
Thanks in advance
Aftab
Message #4 by "Cheng Kok Wai" <kwcheng@i...> on Tue, 30 Apr 2002 09:58:54 +0800
|
|
I try the code as it and I get the following error when I click on the
checkbox
--> document.form1.check is null or not an object
----- Original Message -----
From: "VAN BUTSEL ANDRE" <avanbutsel@b...>
To: "ASP Databases" <asp_databases@p...>
Sent: Tuesday, April 30, 2002 6:16 AM
Subject: [asp_databases] Re: Change the bgcolor of a row dynamically
> Try this:
> <html>
> <head>
> <title>checkboxcolor2</title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> <SCRIPT LANGUAGE="JavaScript">
> function inspectbox(){
> for (var i = 1; i <= 5; i++){
> if (document.form1.check[i].checked){
> document.all.row[i].bgColor = "70DB93"}
> else {
> document.all.row[i].bgColor = "FFFFFF"}
> }
> }
> </SCRIPT>
> </head>
>
> <body bgcolor="#FFFFFF" text="#000000">
> <form name="form1" method="post" action="">
> <table width="50%" border="0" cellspacing="2">
> <tr ID="row1">
> <td width="12%">
> <input type="checkbox" name="check1" value="checkbox"
> onClick="inspectbox()">
> </td>
> <td width="88%">checkbox1</td>
> </tr>
> <tr ID="row2">
> <td width="12%">
> <input type="checkbox" name="check2" value="checkbox"
> onClick="inspectbox()">
> </td>
> <td width="88%">checkbox2</td>
> </tr>
> <tr ID="row3">
> <td width="12%">
> <input type="checkbox" name="check3" value="checkbox"
> onClick="inspectbox()">
> </td>
> <td width="88%">checkbox3</td>
> </tr>
> <tr ID="row4">
> <td width="12%">
> <input type="checkbox" name="check4" value="checkbox"
> onClick="inspectbox()">
> </td>
> <td width="88%">checkbox4</td>
> </tr>
> <tr ID="row5">
> <td width="12%">
> <input type="checkbox" name="check5" value="checkbox"
> onClick="inspectbox()">
> </td>
> <td width="88%">checkbox5</td>
> </tr>
> </table>
> </form>
> </body>
> </html>
>
> ----- Oorspronkelijk bericht -----
> Van: "Aftab Ahmad" <aftab.ahmad@k...>
> Aan: "ASP Databases" <asp_databases@p...>
> Verzonden: maandag 29 april 2002 15:30
> Onderwerp: [asp_databases] Change the bgcolor of a row dynamically
>
>
> > I want to change the background color of a row when I checked the
checkbox
> > against that particular row using JavaScript (just as it works in
hotmail
> > when one check the mail to delete).
> >
> > Thanks in advance
> >
> > Aftab
> >
> >
>
>
>
|
|
 |