/    Sign up×
Community /Pin to ProfileBookmark

HTML Dynamic TABLE HELP

here is a simplified example of what I want to do.

I have a table with where one row contains 2 cells.

the first one has colspan=1 and the second has colspan=2.

On some button click, I want to change the table so the first cell is gone, and the second cell gets colspan=3 (basically it takes up the room of the first cell) I want to leave the other rows unaffected.

I know a little javascript but I’m not sure how to accomplish this.
I can get the contents of cell 1 to disappear using
document.getElementById(“cell1″).innerHTML = ”;

but i cant get it to go away. changing the colspan of cell2 to 3 does not work either because cell 1 still exists.

any help would be appreciated.

to post a comment
HTML

7 Comments(s)

Copy linkTweet thisAlerts:
@KDLAJun 13.2006 — Is the table necessary? Might be easier with a div.

You could have a link that calls some javascript which looks for the element (the column) by ID and switches it to an alternate ID with "display: none;" set.

KDLA
Copy linkTweet thisAlerts:
@klanga2049authorJun 13.2006 — well, the row I want to change does not stand alone, its in the midst of a table with rows above and below.

just happens that I want to change this one.

and

document.getElementById("cell1").style="display:none";

gives me an error...
Copy linkTweet thisAlerts:
@KDLAJun 13.2006 — Tables aren't too functional for layout purposes.

The only other thing I can think of is to have a two part js, which

- looks for cell one, and changes the width to 0 (and gets rid of the content) via a class change

- looks for cell two (the neighboring cell, and changes the width to 100% via another class change
Copy linkTweet thisAlerts:
@klanga2049authorJun 13.2006 — doubt that would work since the other cells in that column won't be set to width=0. and width=0 does not mean the cell won't count for the colspans
Copy linkTweet thisAlerts:
@kelly23Jun 13.2006 — Hi,

document.getElementById("cell1").style="display:none";[/quote]

That should be:
<i>
</i>document.getElementById("cell1").style.display="none";


kelly
Copy linkTweet thisAlerts:
@klanga2049authorJun 14.2006 — Kelly that worked perfectly!

thanks to all for fixing this for me
Copy linkTweet thisAlerts:
@kelly23Jun 14.2006 — You're welcome ?
×

Success!

Help @klanga2049 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...