little Formatting Issue in FIREFOX in SHOW/Hide Column

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
eshban
Forum Contributor
Posts: 184
Joined: Mon Sep 05, 2005 1:38 am

little Formatting Issue in FIREFOX in SHOW/Hide Column

Post by eshban »

Hello,

I have just write a small code which hide the SECOND COLUMN OF CELL when the user clicks on the link. It works well in IE, but the formatting of Second Column disturb in FIREFOX.

If someone fix it, then it will help me very much.

To hide the second column, just refresh the code.

Here is my code:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript">

	function hide(){
		document.getElementById('second').style.display = 'none';
	}


   function showcolumn(){
      // Toggle visibility between none and inline
        document.getElementById('second').style.display = 'inline';
  }  
</script> 
</head>

<body onload=hide()>
	<table border="1" width="80%" align="center">
	  <tr>
		<td onclick="showcolumn()"><a href="#">Click me</a> </td>
		<td id="second">Second Row</td>
		<td id="third">Third Row</td>
	  </tr>
	</table>
	
</body>
</html>

User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You want table-cell, not inline.

Please don't breakup your code into separate blocks if they're the same file.
Post Reply