473,320 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Show hide row in netscape using javascript

Hi,

The following code to show and hide a row works fine in netscape 7 and
IE 6. But everytime the cell is hidden and displayed in netscape, it
adds a new line inside the cell. Please advise.
----snip----
<html>
<head>
<title>Table hide</title>
<script language="javascript">
function flipCell(count){
f=document.getElementById("mcell");
f.style.display=(f.style.display=="block")?"none": "block";
}
</script>
</head>
<body>
<a href="javascript:flipCell(0)">here</a>

<table cellpadding="0" cellspacing="0" border="1" width="95%">
<tr>
<td>Column 1</td>
</tr>
<tr id="mcell" style="display: block;">
<td>Column 2</td>
</tr>
</table>
John Doe
</body>
</html>
---snip---
Thanks in advance,

-Tom
Jul 20 '05 #1
3 13564
Bagbourne" <th************@btinternet.com> wrote in message
news:bd**********@sparta.btinternet.com...
"Thomas Abraham" <th*******@hotmail.com> wrote in message
news:5c**************************@posting.google.c om...
Hi,

The following code to show and hide a row works fine in netscape 7 and
IE 6. But everytime the cell is hidden and displayed in netscape, it
adds a new line inside the cell. Please advise.


Is it essential that you use a table? Could you use a series of DIVs?


This seems to work (tested on Opera, IE5, NS 6.2):

<html>
<head>
<title>Table hide</title>
<script language="javascript">
showRow = (navigator.appName.indexOf("Internet Explorer") != -1) ? "block" :
"table-row";
function flipCell(count)
{
f = document.getElementById("mcell");
f.style.display = (f.style.display == "none") ? showRow : "none";
}
</script>
</head>
<body>
<a href="javascript:flipCell(0)">here</a>

<table cellpadding="0" cellspacing="0" border="1" width="95%">
<tr>
<td>Column 1</td>
</tr>
<tr id="mcell">
<td>Column 2</td>
</tr>
</table>
John Doe
</body>
</html>

Nige
Jul 20 '05 #2
"Nigel White" <Ni********@bagbourne.freeserve.co.uk> wrote in message
news:bd*********@news7.svr.pol.co.uk...
<snip>
This seems to work (tested on Opera, IE5, NS 6.2):

<html>
<head>
<title>Table hide</title>
<script language="javascript">
showRow = (navigator.appName.indexOf("Internet Explorer") != -1) ?
"block" : "table-row";
The problem with this is that there is no relationship between the
navigator.appName property and the default CSS display property for a
table row. Opera might take either option in this test based on user
settings and other browsers that habitually spoof IE may have
implemented the "table-row" CSS property.

Fortunately the decision does not have to be made as it appears to be
the case that browsers will take the setting of the display property to
an empty string as equivalent to setting the property to the default
value for that element, whatever that default value is.
function flipCell(count)
{
f = document.getElementById("mcell");
f.style.display = (f.style.display == "none") ? showRow : "none";
So:-

f.style.display = (f.style.display == "none") ? "" : "none";
}
</script>
</head>
<body>
<a href="javascript:flipCell(0)">here</a>

<snip>

The use of the javascript pseudo-protocol is ill advised as its use
causes numerous unexpected and undesirable effects, some of which are
browser, browser version and/or operating system dependent and thus
difficult to identify:-

<URL: http://jibbering.com/faq/#FAQ4_24 >

Richard.

--

Example JavaScript DOM listings for: Opera 7.11,
Mozilla 1.2 and ICEbrowser 5.4
<URL: http://www.litotes.demon.co.uk/dom_root.html >
Jul 20 '05 #3
Works perfectly! Thanks.
"Nigel White" <Ni********@bagbourne.freeserve.co.uk> wrote in message news:<bd*********@news7.svr.pol.co.uk>...
Bagbourne" <th************@btinternet.com> wrote in message
news:bd**********@sparta.btinternet.com...
"Thomas Abraham" <th*******@hotmail.com> wrote in message
news:5c**************************@posting.google.c om...
Hi,

The following code to show and hide a row works fine in netscape 7 and
IE 6. But everytime the cell is hidden and displayed in netscape, it
adds a new line inside the cell. Please advise.


Is it essential that you use a table? Could you use a series of DIVs?


This seems to work (tested on Opera, IE5, NS 6.2):

<html>
<head>
<title>Table hide</title>
<script language="javascript">
showRow = (navigator.appName.indexOf("Internet Explorer") != -1) ? "block" :
"table-row";
function flipCell(count)
{
f = document.getElementById("mcell");
f.style.display = (f.style.display == "none") ? showRow : "none";
}
</script>
</head>
<body>
<a href="javascript:flipCell(0)">here</a>

<table cellpadding="0" cellspacing="0" border="1" width="95%">
<tr>
<td>Column 1</td>
</tr>
<tr id="mcell">
<td>Column 2</td>
</tr>
</table>
John Doe
</body>
</html>

Nige

Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: adrien | last post by:
Hi, (also posted in netscape.public.mozilla.browser) i use netscape 7 and want to hide the scrollbars of the window when something happens. I tried this: window.scrollbars.visible=false...
5
by: Mark | last post by:
Hi - I have a function which shows/hides a <div> on my page - this appears to oinly work in IE, but I also need it to work in Netscape 7.1. My function is in my head: function openIt(faq) {...
18
by: Michael Skind | last post by:
Hello, I use a simple Table : <TABLE> <TR 1> <TD></TD> </TR> <TR 2> <TD></TD> </TR>
9
by: sergio | last post by:
Hi all, I have created the following script that will show/hide a menu based on checkboxes. It works fine in Opera but not on IE6! Does anybody knows a workaround this problem? Thanks for your...
5
by: Zambien | last post by:
Hi all, Here's my problem. I have tables that are using the menu/submenu idea for hiding rows. This works fine in IE (of course) and does show/hide correctly in netscape, but as soon as the...
4
by: jerryyang_la1 | last post by:
I've found this script that allows be to hide/show form elements.. <script language="JavaScript"><!-- var toggle = true; function show(object) { if (document.layers && document.layers)...
3
by: safiratec | last post by:
Hi, I want to show a div depending of the value of a <select> option, using 2 functions hidediv() and showdiv() - it is working fine in firefox, but not in IE (tested with IE 6 and 7). <body...
2
by: dusk | last post by:
Hi, I have a page with lots of hidden divs which are revealed based on choices made at each 'layer'. So I've used naming convention which represents the order in which each div becomes...
1
oranoos3000
by: oranoos3000 | last post by:
hi would you please help me i have a online shopping center that i show pictures of the my product in home page. in the InterExplorer pictures is shown correctly but in Firefox browser is shown...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.