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

  • Home
  • SEARCH
  • 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 8838911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:07:04+00:00 2026-06-14T10:07:04+00:00

I have 3 columns in a table, each with some text at the top

  • 0

I have 3 columns in a table, each with some text at the top and an image below it. I have it so that when someone clicks an image from one of the 3 columns, it enlarges the column, and deletes the other columns using an onClick event. However, I want it so that when I click the image a second time, it brings back the other columns. The problem I’m having is figuring out how to make the onClick event do something different the second time I click it. I’ve added a couple of (poorly) drawn pictures to help give you an idea. Thanks for your time.

http://i.minus.com/ijFBpWavY386c.jpg

http://i.minus.com/iNExaX8dsN5dK.jpg

Oh, and my current code for the javascript portion (dog, halloween, and comedy are the ID’s of each image. And please excuse my terrible (non-existant) indenting; still in a class to learn javascript.):

function dog()
{
td12 = document.getElementById('td2');
td12.parentNode.removeChild(td12);

td13 = document.getElementById('td3');
td13.parentNode.removeChild(td13);

td11 = document.getElementById('td1');
td11.style.textAlign = "center";
}
function halloween()
{
td21 = document.getElementById('td1');
td21.parentNode.removeChild(td21);

td23 = document.getElementById('td3');
td23.parentNode.removeChild(td23);

td22 = document.getElementById('td2');
td22.style.textAlign = "center";
}
function comedy()
{
td31 = document.getElementById('td1');
td31.parentNode.removeChild(td31);

td32 = document.getElementById('td2');
td32.parentNode.removeChild(td32);

td33 = document.getElementById('td3');
td33.style.textAlign = "center";
}
  • 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-06-14T10:07:05+00:00Added an answer on June 14, 2026 at 10:07 am

    What you need is a variable that is accessible to all your functions which will tell you what ‘mode’ your table is in:

    var allColumns = true;
    
    function comedy() {
        if (allColumns) {
            // ... do stuff here ...
            allColumns = false;
        } else {
            // ... do different stuff here ...
            allColumns = true;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the problem: I have two columns in a table that, for each
I have a table that has three different date columns, so I set each
I have a table in a template, and one of the columns of each
I have an HTML table with 3 columns and amount of text in each
I have a richtextbox that its text is a concatenation of some words from
I have a table who's columns contain two inline divs, one displaying an image,
I have a table with 4 columns. The first column is unique for each
I have a table column where each row has one of three states, and
I have a table with 5 rows and 2 columns. Each cell contains a
I have a table in SQL Server in which one of the columns is

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.