473,383 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

A simple grid rows / columns.

263 100+
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
6 2883
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
viki1967
263 100+
Thanks x your answer.
This code work but open popup window when select the checkbox?
Feb 9 '10 #3
Specifically, what type of popup? Do you mean like a new window?
Feb 9 '10 #4
viki1967
263 100+
Ok, yes new window popup when I select the checkbox.
thanks
Feb 9 '10 #5
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
viki1967
263 100+
Ok, thanks x your help!
Feb 9 '10 #7

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

Similar topics

5
by: Will | last post by:
I've got a simple form that collects data from a user and I want to display that data in a sortable grid or table. The nature of this data is rather temporary, so there's no need to persist it to a...
0
by: Tal Sharfi | last post by:
Hi everyone I recently had the need for StringGrid object same as the one that Delphi has. An object that helps show lists of other objects in a simple grid. I searched the news groups and...
4
by: Mike L | last post by:
I'm open for any suggestions on how to better program this. I want the user to select a license from a combo box, cboPrivilege and then the user will click the add button, then a record will be...
2
by: Kenneth | last post by:
Hi, I want to make sure I got the easiest way on how to bind a grid's datasource to a datatable. I've made an in-memory datatable Dim dtTotal As DataTable Dim drow As DataRow dtTotal = New...
6
by: Tejpal Garhwal | last post by:
I have datagrid filled with some data rows. At the run time i want know how many total rows are there in the data grid ? Any idea ? Any Suggestions ? Thanks in advance Tej
117
by: phil-news-nospam | last post by:
Is there really any advantage to using DIV elements with float style properies, vs. the old method of TABLE and TR and TD? I'm finding that by using DIV, it still involves the same number of...
0
by: Gian Paolo | last post by:
this is something really i can't find a reason. I have a form with a tabcontrol with tree pages, in the second page there is a Data GRid View. Plus i have a class. When i open the form i...
3
by: veenna | last post by:
How can i refresh datagrid in vb.net. I want to display color in one cell in grid but when it loads first time it is working here is my code Public Class Dialog_Colorazione Const YEAR_START...
0
by: patogenic | last post by:
I want to use the grid for record insertion. Everything works fine except after saving the new record; all controls for record insertion are still visible besides the "Add New" button. I think...
2
by: Claudia Fong | last post by:
Hi, How can I create a grid of 20 Columns by 30 Rows using asp.net? Cheers! Claudi *** Sent via Developersdex http://www.developersdex.com ***
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel

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.