Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Re: Change the bgcolor of a row dynamically


Message #1 by "Cheng Kok Wai" <kwcheng@i...> on Fri, 3 May 2002 09:48:17 +0800
the script works great. but wat if I want to named the checkbox lets say
checkbox1, checkbox2..and so on and not all by the same name. how do I
change the javascript then?


----- Original Message -----
From: "Drew, Ron" <RDrew@B...>
To: "ASP Databases" <asp_databases@p...>
Sent: Wednesday, May 01, 2002 7:44 PM
Subject: [asp_databases] Re: Change the bgcolor of a row dynamically


Yes this will work for highlightiing the row for each checkbox checked.
Don't forget to include in your javascript
<!--
//-->
For those people (whoever they may be) that cant process javascript

-----Original Message-----
From: VAN BUTSEL ANDRE [mailto:avanbutsel@b...]
Sent: Wednesday, May 01, 2002 5:12 AM
To: ASP Databases
Subject: [asp_databases] Re: Change the bgcolor of a row dynamically


Sorry
I mixed two scripts
This should do it wright
("rij" = Dutch for "row", "kies" is Dutch for "choose" you can replace
these words in the whole script)

<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 = 0; i
< 5; i++){ if (document.form1.kies[i].checked){
document.all.rij[i].bgColor = "E9C2A6"} else {
document.all.rij[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="rij">
      <td width="12%">
        <input type="checkbox" name="kies" value="checkbox"
onClick="inspectbox()">
      </td>
      <td width="88%">checkbox1</td>
    </tr>
    <tr ID="rij">
      <td width="12%">
        <input type="checkbox" name="kies" value="checkbox"
onClick="inspectbox()">
      </td>
      <td width="88%">checkbox2</td>
    </tr>
    <tr ID="rij">
      <td width="12%">
        <input type="checkbox" name="kies" value="checkbox"
onClick="inspectbox()">
      </td>
      <td width="88%">checkbox3</td>
    </tr>
    <tr ID="rij">
      <td width="12%">
        <input type="checkbox" name="kies" value="checkbox"
onClick="inspectbox()">
      </td>
      <td width="88%">checkbox4</td>
    </tr>
    <tr ID="rij">
      <td width="12%">
        <input type="checkbox" name="kies" value="checkbox"
onClick="inspectbox()">
      </td>
      <td width="88%">checkbox5</td>
    </tr>
  </table>
</form>
</body>
</html>




----- Oorspronkelijk bericht -----
Van: "Cheng Kok Wai" <kwcheng@i...>
Aan: "ASP Databases" <asp_databases@p...>
Verzonden: dinsdag 30 april 2002 3:58
Onderwerp: [asp_databases] Re: Change the bgcolor of a row dynamically


> 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
>
>
> ---
> Change your mail options at http://p2p.wrox.com/manager.asp or to
> unsubscribe send a blank email to
>





Message #2 by "VAN BUTSEL ANDRE" <avanbutsel@b...> on Wed, 1 May 2002 11:11:56 +0200
Sorry
I mixed two scripts
This should do it wright
("rij" = Dutch for "row", "kies" is Dutch for "choose" you can replace these
words in the whole script)

<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 = 0; i < 5; i++){
if (document.form1.kies[i].checked){
document.all.rij[i].bgColor = "E9C2A6"}
else {
document.all.rij[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="rij">
      <td width="12%">
        <input type="checkbox" name="kies" value="checkbox"
onClick="inspectbox()">
      </td>
      <td width="88%">checkbox1</td>
    </tr>
    <tr ID="rij">
      <td width="12%">
        <input type="checkbox" name="kies" value="checkbox"
onClick="inspectbox()">
      </td>
      <td width="88%">checkbox2</td>
    </tr>
    <tr ID="rij">
      <td width="12%">
        <input type="checkbox" name="kies" value="checkbox"
onClick="inspectbox()">
      </td>
      <td width="88%">checkbox3</td>
    </tr>
    <tr ID="rij">
      <td width="12%">
        <input type="checkbox" name="kies" value="checkbox"
onClick="inspectbox()">
      </td>
      <td width="88%">checkbox4</td>
    </tr>
    <tr ID="rij">
      <td width="12%">
        <input type="checkbox" name="kies" value="checkbox"
onClick="inspectbox()">
      </td>
      <td width="88%">checkbox5</td>
    </tr>
  </table>
</form>
</body>
</html>




----- Oorspronkelijk bericht -----
Van: "Cheng Kok Wai" <kwcheng@i...>
Aan: "ASP Databases" <asp_databases@p...>
Verzonden: dinsdag 30 april 2002 3:58
Onderwerp: [asp_databases] Re: Change the bgcolor of a row dynamically


> 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
>
>
>

Message #3 by "Drew, Ron" <RDrew@B...> on Wed, 1 May 2002 07:44:03 -0400
Yes this will work for highlightiing the row for each checkbox checked.
Don't forget to include in your javascript
<!--
//-->
For those people (whoever they may be) that cant process javascript

-----Original Message-----
From: VAN BUTSEL ANDRE [mailto:avanbutsel@b...]
Sent: Wednesday, May 01, 2002 5:12 AM
To: ASP Databases
Subject: [asp_databases] Re: Change the bgcolor of a row dynamically


Sorry
I mixed two scripts
This should do it wright
("rij" =3D Dutch for "row", "kies" is Dutch for "choose" you can replace
these words in the whole script)

<html>
<head>
<title>checkboxcolor2</title>
<meta http-equiv=3D"Content-Type" content=3D"text/html; 
charset=3Diso-8859-1">
<SCRIPT LANGUAGE=3D"JavaScript"> function inspectbox(){ for (var i =3D 
0; i
< 5; i++){ if (document.form1.kies[i].checked){
document.all.rij[i].bgColor =3D "E9C2A6"} else {
document.all.rij[i].bgColor =3D "FFFFFF"} } } </SCRIPT> </head>

<body bgcolor=3D"#FFFFFF" text=3D"#000000">
<form name=3D"form1" method=3D"post" action=3D"">
  <table width=3D"50%" border=3D"0" cellspacing=3D"2">
    <tr ID=3D"rij">
      <td width=3D"12%">
        <input type=3D"checkbox" name=3D"kies" value=3D"checkbox"
onClick=3D"inspectbox()">
      </td>
      <td width=3D"88%">checkbox1</td>
    </tr>
    <tr ID=3D"rij">
      <td width=3D"12%">
        <input type=3D"checkbox" name=3D"kies" value=3D"checkbox"
onClick=3D"inspectbox()">
      </td>
      <td width=3D"88%">checkbox2</td>
    </tr>
    <tr ID=3D"rij">
      <td width=3D"12%">
        <input type=3D"checkbox" name=3D"kies" value=3D"checkbox"
onClick=3D"inspectbox()">
      </td>
      <td width=3D"88%">checkbox3</td>
    </tr>
    <tr ID=3D"rij">
      <td width=3D"12%">
        <input type=3D"checkbox" name=3D"kies" value=3D"checkbox"
onClick=3D"inspectbox()">
      </td>
      <td width=3D"88%">checkbox4</td>
    </tr>
    <tr ID=3D"rij">
      <td width=3D"12%">
        <input type=3D"checkbox" name=3D"kies" value=3D"checkbox"
onClick=3D"inspectbox()">
      </td>
      <td width=3D"88%">checkbox5</td>
    </tr>
  </table>
</form>
</body>
</html>




----- Oorspronkelijk bericht -----
Van: "Cheng Kok Wai" <kwcheng@i...>
Aan: "ASP Databases" <asp_databases@p...>
Verzonden: dinsdag 30 april 2002 3:58
Onderwerp: [asp_databases] Re: Change the bgcolor of a row dynamically


> 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
>
>
> ---
> Change your mail options at http://p2p.wrox.com/manager.asp or to
> unsubscribe send a blank email to
>



  Return to Index