View Full Version : Changing Margins with onClick??

07-29-2010, 05:27 AM

I have a div called pageWrap to wrap my page with the css as


I would like to use Javascript onClick on another div.
This Div is called loginButton, the onclick should change the the css of pageWrap to 0px and onclick again should change it back.

If someone could help me with this code, it would be greatly appreciated

Thanks in advance! :)

07-29-2010, 03:21 PM
<script type="text/javascript">
var login=document.getElementById('loginButton');
var target=document.getElementById('pageWrap');

Important: Regarding those DIV's, I hope that by "called" you mean "they have an id".

And a small note: never throw thanks in advance. This is not the Bawdy House :)

07-30-2010, 12:51 AM
Thank you that is exactly what I wanted!

Now it may not be part of this thread but how do I make it so it slides down??
Or is that too complex?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum