Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Load Page show one div hide others

My code allows links to toggle divs but initially loads them all



11:26 pm on Sep 19, 2010 (gmt 0)

5+ Year Member

Adapting a code that I found on your forum here:


I was able to successfully create a series of links that allow one div at a time to appear on the page. However, when the page loads, all of the divs show up.

I tried creating a new function and calling it with body.onload

function justRecipe() {
document.getElementById('Recipe').style.display = 'block';
document.getElementById('Shopping').style.display = 'none';
document.getElementById('TableTopics').style.display = 'none';
document.getElementById('QualityTime').style.display = 'none';
document.getElementById('Newsletter').style.display = 'none';

<body.onload = justRecipe()>

No luck!

Here is the link to see the code in action:


Help is greatly appreciated.


Jean Fisher
What's For Dinner?
Make dinner time, family time!


8:43 am on Sep 20, 2010 (gmt 0)

10+ Year Member

Welcome to the Webmasterworld.

It should be <body onload="justRecipe();">, without a dot, and with a proper markup.


1:11 pm on Sep 20, 2010 (gmt 0)

5+ Year Member

Thank you, alias. Everything works perfectly.

Featured Threads

Hot Threads This Week

Hot Threads This Month