Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6120077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:37:38+00:00 2026-05-23T15:37:38+00:00

is there any solution to clicking one image and showing two tables? <script type=text/javascript>

  • 0

is there any solution to clicking one image and showing two tables?

 <script type="text/javascript">
    function setTable(what){
    if(document.getElementById(what).style.display=="none"){
    document.getElementById(what).style.display="block";
    }
    else if(document.getElementById(what).style.display=="block"){
    document.getElementById(what).style.display="none";
    }
    }
    </script>

    <img src="../../images/p1.gif" onclick="setTable('table5');">
    <table id='table5' border="0" cellpadding="3" width="100%" style="display:none;">
    <tr>
    ......
    </tr>
    </table>
    <table id='table6' border="0" cellpadding="3" width="100%" style="display:none;">
    <tr>
    ......
    </tr>
    </table>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:37:38+00:00Added an answer on May 23, 2026 at 3:37 pm

    You are not allowed to have multiple objects with the same ID in the same web page. Give the second table a different id and then show both of them separately.

    Change the code to this:

    <script type="text/javascript">
        function setTable(what){
        if(document.getElementById(what).style.display=="none"){
        document.getElementById(what).style.display="block";
        }
        else if(document.getElementById(what).style.display=="block"){
        document.getElementById(what).style.display="none";
        }
        }
    </script>
    
        <img src="../../images/p1.gif" onclick="setTable('table5'); setTable('table6');">
        <table id='table5' border="0" cellpadding="3" width="100%" style="display:none;">
        <tr>
        ......
        </tr>
        </table>
        <table id='table6' border="0" cellpadding="3" width="100%" style="display:none;">
        <tr>
        ......
        </tr>
        </table>
    

    In the click handler, you call setTable twice – once for each ID.
    In the second table, you change the ID

    Or, you could put both tables in a div and hide/show that div.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any persistence solution for Common Lisp, such as Elephant, that allows function
Is there any built-in, add-in solution for visual studio to compare two files and
Is there any solution to overcome case-sensitive problem for contains method. I have code
is there any solution to show user all countries and after select country it
My question is very simple: Is there any solution to install xCode, or equivalent,
I have troubles using a foreign protocol in Objective-C. Is there any other solution
is there any ready to go solution within the microsoft framework, regarding conversion of
Is there any well-known algorithm (or obvious solution) for transforming a list from order
Is there any way to view the contents of the solution user options file
Is there any way to catch all syscalls on Linux? The only solution I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.