I gave you some sample code already, as have others.
You shouldn't be doing table-based layouts anyway - this will only be the first of many problems if you do.
Show hide menu
Moderator: General Moderators
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
- dibyendrah
- Forum Contributor
- Posts: 491
- Joined: Wed Oct 19, 2005 5:14 am
- Location: Nepal
- Contact:
Re: Cut and Paste
Thanks a.heresey for this sample.a.heresey wrote:This is how I hide my menus. I use css to position everything, however.
It's essentially the same as Daedalus', with no blanks for you.Code: Select all
function toggleMenu(){ var menuStyle = document.getElementById(menuId).style; menuStyle.display = (menuStyle.display == 'block')? 'none':'block'; return false; }
If that's not working: I think that if you change your td widths to 20% and *, when the menu dissapears, the body should take over.
I got it working from following with a little modification on it.
Code: Select all
<script language="javascript">
function toggleMenu(menuId){
var menuStyle = document.getElementById(menuId).style;
menuStyle.display = (menuStyle.display == 'block')? 'none':'block';
return false;
}
</script>Code: Select all
<table width="100%">
<td width="15%" height="100%" valign="top" align="left" id="menuId">
--Menu Goes Here --
</td>
<td width="85%" valign="top" id="body">
--Body Contents Goes Here --
<a href="#" onclick="javascript:toggleMenu('menuId');">Show/Hide</a>
</td>
</table>Thank you.
There's something in the way
Maybe if you wrote another function that rewrote the table when the menu was hidden. But I'm sure you'll find that a silly solution.
You could make the menu and the body two separate tables, and then when you hide one the other would flow into its space.
But if you're going to do that, why not just make them two seperate divs? Divs are like little stretchy tables that will make your life easier. You can even put tables into divs.
Don't be afraid. Join us.
You could make the menu and the body two separate tables, and then when you hide one the other would flow into its space.
But if you're going to do that, why not just make them two seperate divs? Divs are like little stretchy tables that will make your life easier. You can even put tables into divs.
Don't be afraid. Join us.
- dibyendrah
- Forum Contributor
- Posts: 491
- Joined: Wed Oct 19, 2005 5:14 am
- Location: Nepal
- Contact:
- daedalus__
- DevNet Resident
- Posts: 1925
- Joined: Thu Feb 09, 2006 4:52 pm
- dibyendrah
- Forum Contributor
- Posts: 491
- Joined: Wed Oct 19, 2005 5:14 am
- Location: Nepal
- Contact: