#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    Mumbai, India
    Posts
    276
    Rep Power
    14

    Drawing Table borders using JavaScript


    Hi,

    Is it possible that if I click on the link and the table in the current document has broders.

    something like this..

    <a href="JavaScript:;"
    for(i=0;i<document.all.length;i++)if(document.all[i].tagName=='TABLE')void(document.all[i].border=(document.all[i].border=='0')?'1':'0');>Click here for broders </a>

    <TABLE>
    <tr><td>First Cell</td><td>second Cell</td></tr>
    </TABLE>

    Thanks
    Shantanu Oak
    shantanuo@yahoo.com
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2002
    Location
    Inside the GNU/Hurd kernel
    Posts
    492
    Rep Power
    12
    Sure;
    Code:
    <script>
    function ShowBorder(){
    	var table_node_list = document.getElementsByTagName("table");
    	
    	for (var i = 0; i < table_node_list.length; i++) {
    	table_node_list[i].border="1";
    	}
    }
    
    </script>
    <a href="javascript:ShowBorder();">Click here for borders</a>

IMN logo majestic logo threadwatch logo seochat tools logo