strip table rows with input boxes so looks like excel

Posted on 2013-01-14
Medium Priority
Last Modified: 2013-01-22
uisng javascript, jquery I need the following to be styled so that the rows are striped
and the input boxes within are part of the striping so that it appears the input area is the table border that is the cell, in other words, Excel like.

h += "<tbody id='4_TimeCard_Rows'  ref=cdhrows>\
<tr  class='repeating'>\
<td id='R4:C1' xl='A'><input class='ChargeCodeKey' type='hidden' style='width:200px'><input class='HourCodeId' type='hidden' ><input class='HourCodeDesc input-large' ></td>\
<td id='R4:C2' xl='B'><input class='fund'  id='fund_1' name='fund_1' path=BT20.IFPYTcImp  region=time-entry onblur='updateXML($(this))' ></td>\
<td id='R4:C3' xl='C'><input class='dept'  id='dept_1' name='dept_1' path=BT20.IFPYTcImp  ></td>\
<td id='R4:C4' xl='D'><input class='loc' id='loc_1' name='loc_1' value='' ></td>\
<td id='R4:C5' xl='E'><input class='obj' id='obj_1' name='obj_1' style=\"display:block\"></td>\
<td id='R4:C6' xl='F'><input class='proj' id='proj_1' name='proj_1'  ></td>\
<td id='R4:C7' xl='G'><input class='task' id='task_1' name='task_1' ></td>\
<td id='R4:C8' xl='H'><input class='Total_Day1_Day14 ' ></td>\
<td id='R4:C9' xl='I'><input class='Day1' id='Day1_1' name='Day1_1' ></td>\
<td id='R4:C10' xl='J'><input class='Day2'  id='Day2_1' name='Day2_1' ></td>\
<td id='R4:C11' xl='K'><input class='Day3'  id='Day3_1' name='Day3_1' ></td>\
<td id='R4:C12' xl='L'><input class='Day4'  id='Day4_1' name='Day4_1' ></td>\
<td id='R4:C13' xl='M'><input class='Day5'  id='Day5_1' name='Day5_1' ></td>\
<td id='R4:C14' xl='N'><input class='Day6'  id='Day6_1' name='Day6_1' ></td>\
<td id='R4:C15' xl='O'><input class='Day7'  id='Day7_1' name='Day7_1' ></td>\
<td id='R4:C16' xl='P'><input class='Total_Day1_Day7'></td>\
<td id='R4:C17' xl='Q'><input class='Day8'  id='Day8_1' name='Day8_1' ></td>\
<td id='R4:C18' xl='R'><input class='Day9'  id='Day9_1' name='Day9_1' ></td>\
<td id='R4:C19' xl='S'><input class='Day10'  id='Day10_1' name='Day10_1' ></td>\
<td id='R4:C20' xl='T'><input class='Day11'  id='Day1_11' name='Day1_11' ></td>\
<td id='R4:C21' xl='U'><input class='Day12'  id='Day1_12' name='Day1_12' ></td>\
<td id='R4:C22' xl='V'><input class='Day13'  id='Day1_13' name='Day1_13' ></td>\
<td id='R4:C23' xl='W'><input class='Day14'  id='Day1_14' name='Day1_14'  ></td>\
<td id='R4:C24' xl='X'><input class='Total_Day8_Day14' ></td>\
<td id='R4:C25' xl='Y' ><input type='text' class='comments'  id='comments_1' name='comments_1' maxlength='40' ></td>\
<td id='R4:C26' xl='Z' class='add'>+</td>\
Question by:KeithMcElroy

Expert Comment

ID: 38777750
I suggesto you to take a look to the table tag properties, either if you intend to place input boxes inside the cells or not.
LVL 19

Accepted Solution

Albert Van Halen earned 2000 total points
ID: 38784588
Zebra striping via css3 (no scripting needed !):
table tr:nth-child(even) {
  background-color: blue;

table tr:nth-child(odd) {
  background-color: white;

Open in new window

If you want to 'blend in' the textboxes, remove the borders en set background-color to transparent
table input {
   border: medium none;
   background-color: transparent;

Open in new window


Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question