A simple grid rows / columns.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • viki1967
    Contributor
    • Oct 2007
    • 263

    A simple grid rows / columns.

    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
  • harrierdh
    New Member
    • Jan 2010
    • 16

    #2
    This should get you going.

    Code:
    <script>
    function colorThisRow(row) {
    	if (document.getElementById("check" + row).checked) {
    		document.getElementById("row" + row).style.backgroundColor = "yellow";
    	} else {
    		document.getElementById("row" + row).style.backgroundColor = "white";
    	}
    }
    </script>
    <table border>
        <tr id="row1">
    		<td>
    			<input type="checkbox" id="check1" onClick="colorThisRow(1)" />Click Me
    		</td>
    		<td>
    		    Some stuff here1
    		</td>
    	</tr>
        <tr id="row2">
    		<td>
    			<input type="checkbox" id="check2" onClick="colorThisRow(2)" />Click Me
    		</td>
    		<td>
    		    Some stuff here2
    		</td>
    	</tr>
    </table>

    Comment

    • viki1967
      Contributor
      • Oct 2007
      • 263

      #3
      Thanks x your answer.
      This code work but open popup window when select the checkbox?

      Comment

      • larztheloser
        New Member
        • Jan 2010
        • 86

        #4
        Specifically, what type of popup? Do you mean like a new window?

        Comment

        • viki1967
          Contributor
          • Oct 2007
          • 263

          #5
          Ok, yes new window popup when I select the checkbox.
          thanks

          Comment

          • larztheloser
            New Member
            • Jan 2010
            • 86

            #6
            A very easy way to do this would be to append this code to your checkbox function:

            Code:
            w=window.open();
            w.document.open();
            w.document.write("<h1>This is my popup!</h1><p>Put something meaningful here...</p>");
            w.document.close();
            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,val ue) methods are too simplistic for your needs?

            Comment

            • viki1967
              Contributor
              • Oct 2007
              • 263

              #7
              Ok, thanks x your help!

              Comment

              Working...