JavaScript

Moderators: None (Apply to moderate this forum)
Number of threads: 2058
Number of posts: 5158

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Help me....Fold out table on click in Netscape 4.x Posted by Lara_tin2 on 2 Apr 2004 at 5:22 AM
I have a table contain data .I would like the table is hide , but when user click in its heading(or link ,button ...) It will be shown.
Ex :
Before click:
Heading
After click on Heading
Heading
data1 data2 data3
data4 data5 data6....

I tried to use table.style.display = 'none' and table.style.display = 'block'.
It works well in IE .But in Netscape 4.x , nothing happen when I click in tables heading.
How can I do ?
Thanks!!!

My code is like :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script>
function togle(){
var table = document.getElementById('table2');

if (table.style.display=='none'){
table.style.display='block';

}else{
table.style.display='none';
}
}
</script>
</HEAD>

<BODY>
<a href="#" onClick="togle();">Show/Hide</a>
<br>
TABLE1
<table id="table1" border="1">
<tr>
<td>data1
</td>
<td>
data2
</td>
</tr>
<tr>
<td>
data3
</td>
<td>
data4
</td>
</tr>
</table>
<br>
TABLE2
<table id="table2" border="1">
<tr>
<td>data5
</td>
<td>
data6
</td>
</tr>
<tr>
<td>
data7
</td>
<td>
data8
</td>
</tr>
</table>
<br>
TABLE3
<table id="table2" border="1">
<tr>
<td>data9
</td>
<td>
data10
</td>
</tr>
<tr>
<td>
data11
</td>
<td>
data12
</td>
</tr>
</table>

</BODY>
</HTML>


Report
Re: Help me....Fold out table on click in Netscape 4.x Posted by Weirdofreak on 2 Apr 2004 at 7:34 AM
NS4 is hideous. You can't change the display: style of anything. In fact, you can't change most styles, and the ones that you vcan change can only be changed with a poition of absoute or relative. See http://www.quirksmode.org/browsers/netscape4.html for more.
Report
Re: Help me....Fold out table on click in Netscape 4.x Posted by zanfardinom on 2 Apr 2004 at 8:58 AM
Hey hope this helps,

function goes in heading
<head>
<script language="JavaScript">
<!--
function SwitchMenu(obj){
if(document.getElementById){
var el = document.getElementById(obj);
var ar = document.getElementById("cont").getElementsByTagName("DIV");
if(el.style.display == "none"){
for (var i=0; i<ar.length; i++){
ar[i].style.display = "none";
}
el.style.display = "block";
}else{
el.style.display = "none";
}
}
}
-->
</script>
</head>

in the body
<body>
<div id="cont">
<p id="menu1" onClick="SwitchMenu('sub1');" title="Data 1">View Data</p>
<div id="sub1" style="display:none;">
<a href="data1.htm" title="data1">data1<br>
<a href="data2.htm" title="data2">data2</div>
</body>

Then you can add some css to it so you can make it look good. Hope this helps.

mdawg




: I have a table contain data .I would like the table is hide , but when user click in its heading(or link ,button ...) It will be shown.
: Ex :
: Before click:
: Heading
: After click on Heading
: Heading
: data1 data2 data3
: data4 data5 data6....
:
: I tried to use table.style.display = 'none' and table.style.display = 'block'.
: It works well in IE .But in Netscape 4.x , nothing happen when I click in tables heading.
: How can I do ?
: Thanks!!!
:
: My code is like :
: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
: <HTML>
: <HEAD>
: <TITLE> New Document </TITLE>
: <META NAME="Generator" CONTENT="EditPlus">
: <META NAME="Author" CONTENT="">
: <META NAME="Keywords" CONTENT="">
: <META NAME="Description" CONTENT="">
: <script>
: function togle(){
: var table = document.getElementById('table2');
:
: if (table.style.display=='none'){
: table.style.display='block';
:
: }else{
: table.style.display='none';
: }
: }
: </script>
: </HEAD>
:
: <BODY>
: <a href="#" onClick="togle();">Show/Hide</a>
:
: TABLE1
: <table id="table1" border="1">
: <tr>
: <td>data1
: </td>
: <td>
: data2
: </td>
: </tr>
: <tr>
: <td>
: data3
: </td>
: <td>
: data4
: </td>
: </tr>
: </table>
:
: TABLE2
: <table id="table2" border="1">
: <tr>
: <td>data5
: </td>
: <td>
: data6
: </td>
: </tr>
: <tr>
: <td>
: data7
: </td>
: <td>
: data8
: </td>
: </tr>
: </table>
:
: TABLE3
: <table id="table2" border="1">
: <tr>
: <td>data9
: </td>
: <td>
: data10
: </td>
: </tr>
: <tr>
: <td>
: data11
: </td>
: <td>
: data12
: </td>
: </tr>
: </table>
:
: </BODY>
: </HTML>
:
:
:

Report
Re: Help me....Fold out table on click in Netscape 4.x Posted by Lara_tin2 on 4 Apr 2004 at 10:49 PM
It does not work!Netscape 4 seem not support style block-hide!
Report
Re: Help me....Fold out table on click in Netscape 4.x Posted by zanfardinom on 5 Apr 2004 at 11:05 AM
I'm sorry about that. I will look more into it. I know this works for the latest version of Netscape. I didn't think to test in 4.x. I will get back to ya.

mdawg

: It does not work!Netscape 4 seem not support style block-hide!
:

Report
Re: Help me....Fold out table on click in Netscape 4.x Posted by Weirdofreak on 6 Apr 2004 at 12:29 PM
It supports it, but it cvan't be changed. See my earlier post for a link to a list of which ones can be. You could use Z-index or visibility, but the page wouldn't reflow, so it's hardly worth it. My advice would be not to bother with NS4, it's just too incompatible.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.