473,668 Members | 2,552 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hiding and Displaying 2 HTML tables in the same place with DHTML

I would like to be able to display either one or the other HTML table
in the same place. I.e., there are 2 buttons on the screen. When the
user clicks one button, the table A is displayed below. When the user
clicks the other button, the table A disappears and the table B appears
in the same place.

When I use the classic div tags followed by table code, they are
displayed sequentially on the page, rather than in the same place.

Can someone help with a code snippet and advice?

Thanks!!!

Jul 23 '05 #1
1 1445
Hi,
When I use the classic div tags followed by table code, they are displayed sequentially on the page, rather than in the >same place.


You may not have provided enough information, but to me it sounds like
you haven't done anything with css? If that is the case, let's assume
table A is the first table displayed like so in your html:

<input type = "button" onClick = "toggleA()" />
<input type = "button" onClick = "toggleB()" />

<div id = "tableA" style = "display: block">
[your tableA code]
</div>

<div id = "tableB" style = "display: none">
[your tableB code]
</div>

Please note this isn't the most efficient of code, but it'll get you
by. In your javascript you could have the following:

function toggleA()
{
document.getEle mentById("table B").style.displ ay = "none";
document.getEle mentById("table A").style.displ ay = "block";
}

function toggleB()
{
document.getEle mentById("table A").style.displ ay = "none";
document.getEle mentById("table B").style.displ ay = "block";
}

This will in effect "hide" one table, and in it's place show the other
table instead.

Hope this helps.

Jul 23 '05 #2

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

Similar topics

0
1386
by: Fuzzyman | last post by:
Does anyone know of an 'easy' way of displaying HTML from python - preferably using standard Tkinter widgets. I've heard that the 'Text' widget can be used to do this - but I don't fancy hand building an HTML parser when it's quite likely someone else has already done it..... I don't *need* eternal links to work, or even stylesheets or tables, but I'd like the other basic tags to work.
15
65751
by: Code Monkee | last post by:
How can the toolbar and menubar be hidden in IE? When opening the window via javascript I can specify 'toolbar=no,menubar=no', which works fine. However if the window already exists how can I remove them? If the browser is Netscape I can use javascript: window.toolbar.visible = false; window.menubar.visible = false; but IE produces the error: "'window.toolbar.visible' is null or not an object".
3
1753
by: atomo | last post by:
Hi, i'm wondering why this hiding and showing function works on IE (6) but it doesn't work in Mozilla Firebird (0.7) function fnc_show(num){ for(i=1;i<7;i++){ eval("t_" + i + ".style.display = \"none\""); } eval("t_" + num + ".style.display = \"inline\"");
2
15051
by: Andy Fish | last post by:
Hi, I am trying to show/hide a group of table rows using javascript and CSS. if I group them in a <tbody> element I can do: my_tbody_element.style.display="none"; to hide them and my_tbody_element.style.display="block";
10
2287
by: Peter Kirk | last post by:
Hi there can someone please help me with creating dynamic content in a table? For example, see the below javascript and html - why is a new row not created in the table when I click the button? (I am using Internet Explorer 6). <html> <head> <title>TEST</title> <script language="javascript">
1
1711
by: LastOfEight | last post by:
I'm trying to hide tables in the code below, but it is not working. Could someone take a look at my code? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD><TITLE>Untitled Document</TITLE> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <SCRIPT type=text/javascript> <!--//
1
553
by: luvdairish | last post by:
Can someone please look at my code and see why tables are not hiding properly? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD><TITLE>Untitled Document</TITLE> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <SCRIPT type=text/javascript> <!--//
38
7129
by: | last post by:
I have a script... ----- <SCRIPT language="JavaScript" type="text/javascript"> <!-- function makeArray() { for (i = 0; i<makeArray.arguments.length; i++) this = makeArray.arguments; } function makeArray0() {
9
4556
by: Cogito | last post by:
My program builds several tables using inner HTML. All the tables are displayed only when the program terminates. How can I make it display one table at a time and then wait for a click before displaying the next table?
0
8459
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8367
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
8889
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
8790
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...
1
8570
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7391
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...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5677
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();...
2
1779
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.