Solved

CSS with javascript code that draw a border for table's row.

Posted on 2007-03-19
2
525 Views
Last Modified: 2010-05-18
Hi, I need CSS with javascript code that draw a border for table's row(Please note row and not cell).
0
Comment
Question by:Abdu_Allah
2 Comments
 
LVL 15

Accepted Solution

by:
stanscott2 earned 500 total points
ID: 18751137
Say you have this table:

<table id="myTable">
     <tr>
          <td></td>
     </tr>
     <tr>
         <td></td>
     </tr>
</table>

And you want a border around the second row.  Use this:

function setBorder() {
     var rowToSet = document.getElementById("myTable").rows[1];
     rowToSet.style.border = '2px solid black';
}
0
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 18751384
Are you sure that works?! it does not work with me: here is my entire page:

<HTML>
<HEAD>
 <script type="text/javascript">
      function setborder(){
      var rowToSet = document.getElementById("myTable").rows[1];
     rowToSet.style.border = '2px solid black';
     }
</script>
</HEAD>
<BODY onload="myfunction">

<table id="myTable"  >
     <tr >
          <td>row 1</td>
     </tr>
     <tr>
         <td>row 2</td>
     </tr>
     <input type="button" onclick="setborder()" value="test" />
</table>
</BODY>
</HTML>


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

911 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now