Jump to content

javascript messes up table


arbitter

Recommended Posts

Hi there,

 

So I have this problem where I'm hiding a table row, and when I wish to display it, the table gets all messed up.

<table border='1'>
<tr>
	<td>Dag:</td>
	<td><select name='begindag'><?php for($i=1; $i<=31; $i+=1){echo "<option value='$i'>$i</option>";} ?> </select></td>
</tr>
<tr>
	<td>Maand:</td>
	<td><select name='beginmaand'><?php for($i=1; $i<=12;$i+=1){echo "<option value='$i'>$months[$i]</option>";} ?></select></td>
</tr>
<tr id='vraag'>
	<td colspan='2' onclick="hideShow('vraag');hideShow('datum2');hideShow('datum');" align='center' style='cursor:pointer'>Einddatum geven?</td>
</tr>
<tr id='datum' style='display:none;'>
	<td>Einddag:</td>
	<td><select name='einddag'><?php for($i=1; $i<=31; $i+=1){echo "<option value='$i'>$i</option>";} ?> </select></td>
</tr>
<tr id='datum2' style='display:none;'>
	<td>Eindmaand:</td>
	<td><select name='eindmaand'><?php for($i=1; $i<=12;$i+=1){echo "<option value='$i'>$months[$i]</option>";} ?></select></td>
</tr>
</table>

 

and the hideShow() is simply:

function hideShow(id)
{
var object = document.getElementById(id).style
if (object.display == "none")
{
	object.display = "block";
}
else
{
	object.display = "none";
}
}[code]

I've tried by giving my table an absoulte position, but it doesn't work, still messes it up... when showing the hidden rows, both <td>'s get shown in one column, causing the first two rows' first cell to expand.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.