473,655 Members | 3,057 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="javas cript">
function flipCell(count) {
f=document.getE lementById("mce ll");
f.style.display =(f.style.displ ay=="block")?"n one":"block";
}
</script>
</head>
<body>
<a href="javascrip t: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 13582
Bagbourne" <th************ @btinternet.com > wrote in message
news:bd******** **@sparta.btint ernet.com...
"Thomas Abraham" <th*******@hotm ail.com> wrote in message
news:5c******** *************** ***@posting.goo gle.com...
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="javas cript">
showRow = (navigator.appN ame.indexOf("In ternet Explorer") != -1) ? "block" :
"table-row";
function flipCell(count)
{
f = document.getEle mentById("mcell ");
f.style.display = (f.style.displa y == "none") ? showRow : "none";
}
</script>
</head>
<body>
<a href="javascrip t: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********@bag bourne.freeserv e.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="javas cript">
showRow = (navigator.appN ame.indexOf("In ternet Explorer") != -1) ?
"block" : "table-row";
The problem with this is that there is no relationship between the
navigator.appNa me 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.getEle mentById("mcell ");
f.style.display = (f.style.displa y == "none") ? showRow : "none";
So:-

f.style.display = (f.style.displa y == "none") ? "" : "none";
}
</script>
</head>
<body>
<a href="javascrip t: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********@bag bourne.freeserv e.co.uk> wrote in message news:<bd******* **@news7.svr.po l.co.uk>...
Bagbourne" <th************ @btinternet.com > wrote in message
news:bd******** **@sparta.btint ernet.com...
"Thomas Abraham" <th*******@hotm ail.com> wrote in message
news:5c******** *************** ***@posting.goo gle.com...
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="javas cript">
showRow = (navigator.appN ame.indexOf("In ternet Explorer") != -1) ? "block" :
"table-row";
function flipCell(count)
{
f = document.getEle mentById("mcell ");
f.style.display = (f.style.displa y == "none") ? showRow : "none";
}
</script>
</head>
<body>
<a href="javascrip t: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
11467
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 window.scrollbars.visibility="no" .... nothing works Is it also possible only to hide the vertical scrollbar instead of both?
5
6036
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) { showIt = document.all(faq); if (showIt.style.display == "none") { showIt.style.display = "" } else {
18
2279
by: Michael Skind | last post by:
Hello, I use a simple Table : <TABLE> <TR 1> <TD></TD> </TR> <TR 2> <TD></TD> </TR>
9
2753
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 response. Sergio ------------------------------------------------ <script language="JavaScript" type="text/javascript">
5
2172
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 shown method is called, the table gets skewed and the presentation of the data on the page goes horribly wrong. I don't think this is a table issue as I have spent alot of time staring at this code. Here is the html...
4
7994
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) document.layers.visibility = 'visible'; else if (document.all) { document.all.style.visibility = 'visible';
3
7767
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 onload="javascript:hidediv()"> DOES work in IE, but the rest does not. Any ideas? Thanks a lot Tim here is the code ----------------------------
2
2140
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 visible - 'a100', 'a200', 'a300' for the first 'layer'; 'b100', 'b200', 'b300' for the second; 'c100, 'c200', 'c300' for the third ... etc I'm writing the javascript functions to hide and show the appropriate divs and its getting out of hand pretty...
1
3799
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 properties alt in img tag istead of picture . place of the pictures is saved in the database(my database is with mysql) and in home page i fetch properties of the product and address of place that pictures is located output of the code in the...
0
8296
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8710
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8598
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7310
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5627
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4299
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2721
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.