473,386 Members | 1,817 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,386 software developers and data experts.

HELP: Problem setting style.display in NETSCAPE 6+

Hi Experts.

Please put the code sample below into an html document and take a look
at in NN6+. One span should be shown while the other is hidden.
Clicking the button should reverse this. However it doesn't.
Removing the table structure from around the text fixes it, but I need
the table structure (this is very simplified example).

Hope someone can provide an alternative?

Thanks,

Stewart

<html>
<head>
<title>Spans</title>
<script type="text/javascript">
function hideShow()
{
var spn1 = document.getElementById("spnShow");
var spn2 = document.getElementById("spnHide");
if (spn1.style.display == "inline")
{
spn1.style.display = "none";
spn2.style.display = "inline";
}
else
{
spn1.style.display = "inline";
spn2.style.display = "none";
}

}
</script>
</head>

<body bgcolor="#FFFFFF">
<input type="button" value="Hide/Show" onclick="hideShow();">
<span id="spnShow" style="display: inline"><table><tr><td>Why can't I
be hidden?</td></tr></table></span>
<span id="spnHide" style="display: none"><table><tr><td>I should not
be visible</td></tr></table></span>
</body>
</html>
Jul 23 '05 #1
2 1900
Ivo
"Stewart" <wi**************@yahoo.com.au> wrote in message
news:3e**************************@posting.google.c om...
Hi Experts.

Please put the code sample below into an html document and take a look
at in NN6+. One span should be shown while the other is hidden.
Clicking the button should reverse this. However it doesn't.
Removing the table structure from around the text fixes it, but I need
the table structure (this is very simplified example).

<span id="spnShow" style="display: inline"><table><tr><td>Why can't I
be hidden?</td></tr></table></span>
<snip rest>


Your function looks fine but why not toggle the display of the table itself?
<table id="tblShow">...

HTH
Ivo

Jul 23 '05 #2
DU
Stewart wrote:
Hi Experts.

Please put the code sample below into an html document and take a look
at in NN6+. One span should be shown while the other is hidden.
Clicking the button should reverse this. However it doesn't.
Removing the table structure from around the text fixes it, but I need
the table structure (this is very simplified example).

Hope someone can provide an alternative?

Thanks,

Stewart

<html>
<head>
<title>Spans</title>
<script type="text/javascript">
function hideShow()
{
var spn1 = document.getElementById("spnShow");
var spn2 = document.getElementById("spnHide");
if (spn1.style.display == "inline")
{
spn1.style.display = "none";
spn2.style.display = "inline";
}
else
{
spn1.style.display = "inline";
spn2.style.display = "none";
}

}
</script>
</head>

<body bgcolor="#FFFFFF">
<input type="button" value="Hide/Show" onclick="hideShow();">
<span id="spnShow" style="display: inline"><table><tr><td>Why can't I
be hidden?</td></tr></table></span>
<span id="spnHide" style="display: none"><table><tr><td>I should not
be visible</td></tr></table></span>
</body>
</html>

Your markup code is certainly not valid here. A block-level (table)
element can not be nested in an inline (span) element.
Also, I suspect you're using tables to render non-tabular data. So why
not solve your real problem to begin with? You should not use, you don't
need to use table to render text content to begin with.

DU
Jul 23 '05 #3

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

Similar topics

14
by: Akbar | last post by:
Hey there, Big-time curiosity issue here... Here's the test code (it's not that long)... it's to display a large number of image links with captions, ideally pulled in from an external file...
5
by: Chris Beall | last post by:
I'm displaying an image that is also a link against a black background. In Netscape 7.1, the current background color is displayed as a horizontal bar below the image. This allows :hover effects...
20
by: Jeff Nibler | last post by:
I'm trying to set the width of a textbox via a style sheet but it isn't working for Netscape 4.7 This is what the page looks like: <form> <input type="text" class="t1"> </form> This is...
3
by: Iver Erling Årva | last post by:
Can anyone please tell me why this doesn't work? The sign changes when I hit the button, and I get no error messages, but the textarea doesn't disappear/reappear. <html> <head> <title>New...
3
by: Fabian | last post by:
How can I read the object.style.display attribute? With teh following: var x = object.style.display; I always get a result of undefined. Solutions? -- -- Fabian
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...
1
by: Anna K. | last post by:
Hi Experts, I'm new to JavaScript and web-based apps development, so I'll tell you right off that I don't really know my way around it as of yet. I'm trying to create a code library set with...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
9
by: dli07 | last post by:
Hello, I'm trying to convert a piece of code that creates a dynamic vertical resizing bar in a table from internet explorer to firefox. It's based on a post from...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...

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.