Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-24-2010, 02:25 PM   PM User | #1
zerpex
New to the CF scene

 
Join Date: Jul 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
zerpex is an unknown quantity at this point
Show / Hide div via onload on menu

Hello, at the moment I'm creating a website where on the frontpage (index.php) there is 2 divs that contains first a monitor-image with 3 computer screens, and then a div, that set an overlay over 2 of the screens - the divs like this:

<code>
<div id="monitor_overlay"></div> //Contains the overlay
<div id="lastest"></div> //Contains the screens
</code>

The CSS is:

<css>
#lastest {
position:absolute;
top:121px;
width:960px;
height:397px;
background:url(../images/monitor_bg.png);
z-index:-1;
}

#monitor_overlay {
position:absolute;
top:136px;
margin-left:256px;
width:443px;
height:277px;
background:url(../images/monitor_overlay.png) no-repeat;
z-index:1;
}
</css>

Those screens are needed on the index.php only - other content will be shown on the other sites.

That I need is a javascript that does following:

When loading the site it will automaticly load index.php - aka it shows the divs.

Then when I press on the menu-button "Blog" or "Portfolio" it should hide the divs "monitor_overlay" and "lastest"

but then if I press on "Home" again - I want the divs to be shown - How do I do this?

I have searched for hours, and yeah to be honest, I'm not good at javascript - the only thing I have made once was to replace a background color and image when clicking a link or a menu-button:

onclick="document.body.style.background='#169EF2 URL(\'images/background-darkblue.jpg\') center repeat-y fixed';"

But hiding/showing a div when clicking a menu button is really a big problem for me - the only way I could se it should work should be something like this:

Code:
onclick="document.div.StyleByID('lastest','monitor_overlay').display.hidden;','document.div.StyleByID('anotherdiv').display.visible;"
but it don't works.

Any that can help? it would be so wonderful!

Thank you, best regards,

Lucas Kristensen
zerpex is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:11 PM.


Advertisement
Log in to turn off these ads.