By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,533 Members | 2,102 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,533 IT Pros & Developers. It's quick & easy.

A simple grid rows / columns.

100+
P: 263
Hi all.

I need your help.

I realize this script and I do not know where to begin:

1) A simple grid rows / columns.
2) The first column contain an input type = "checkbox"
3) When select the input type, the line should change color than the other rows, and you should open a popup window.

For points 1, 2 you are OK.
Point 3 is the difficulty.

Suggestions?
Examples?

Kind regards
Viki
Feb 8 '10 #1
Share this Question
Share on Google+
6 Replies


P: 16
This should get you going.

Expand|Select|Wrap|Line Numbers
  1. <script>
  2. function colorThisRow(row) {
  3.     if (document.getElementById("check" + row).checked) {
  4.         document.getElementById("row" + row).style.backgroundColor = "yellow";
  5.     } else {
  6.         document.getElementById("row" + row).style.backgroundColor = "white";
  7.     }
  8. }
  9. </script>
  10. <table border>
  11.     <tr id="row1">
  12.         <td>
  13.             <input type="checkbox" id="check1" onClick="colorThisRow(1)" />Click Me
  14.         </td>
  15.         <td>
  16.             Some stuff here1
  17.         </td>
  18.     </tr>
  19.     <tr id="row2">
  20.         <td>
  21.             <input type="checkbox" id="check2" onClick="colorThisRow(2)" />Click Me
  22.         </td>
  23.         <td>
  24.             Some stuff here2
  25.         </td>
  26.     </tr>
  27. </table>
  28.  
  29.  
  30.  
Feb 8 '10 #2

100+
P: 263
Thanks x your answer.
This code work but open popup window when select the checkbox?
Feb 9 '10 #3

P: 86
Specifically, what type of popup? Do you mean like a new window?
Feb 9 '10 #4

100+
P: 263
Ok, yes new window popup when I select the checkbox.
thanks
Feb 9 '10 #5

P: 86
A very easy way to do this would be to append this code to your checkbox function:

Expand|Select|Wrap|Line Numbers
  1. w=window.open();
  2. w.document.open();
  3. w.document.write("<h1>This is my popup!</h1><p>Put something meaningful here...</p>");
  4. w.document.close();
  5.  
PRO: Very flexible, widely supported
CON: Many browsers open this in a new tab and sometimes don't even give the tab focus!

I do assume that the simple alert(text), confirm(text) and prompt(text,value) methods are too simplistic for your needs?
Feb 9 '10 #6

100+
P: 263
Ok, thanks x your help!
Feb 9 '10 #7

Post your reply

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