svgmx5 Posted April 5, 2010 Share Posted April 5, 2010 I'm having some problems hiding a div block and displaying another one. this is my first attempt and creating something with JavaScript with out using a tutorial or anything so i would really appreciate any help, so i can learn what i want is to have a div block display initially so when a user goes to the page they see the registration form, but if they already have an account they can just click a link that says log in and the registration form hides and the login form shows. However right now its only hiding both and not displaying anything when the link is clicked Here's the javascript code i'm using <script type="text/javascript"> function toggleview() { if(document.getElementById("login")){ login.style.display = 'inline'; document.getElementById("register").style.display = 'none'; }else{ login.style.display = 'none'; document.getElementById("register").style.display = 'inline'; } if(document.getElementById("register")){ login.style.display = 'inline'; document.getElementById("login").style.display = 'none'; }else{ login.style.display = 'none'; document.getElementById("login").style.display = 'inline'; } } </script> And here's what the link looks like <h4><a href="#" onclick="toggleview()">Allready Have an Account?</a></h4> Quote Link to comment https://forums.phpfreaks.com/topic/197674-showing-and-hiding-a-div-block/ Share on other sites More sharing options...
taquitosensei Posted April 5, 2010 Share Posted April 5, 2010 nm I'm an idiot Quote Link to comment https://forums.phpfreaks.com/topic/197674-showing-and-hiding-a-div-block/#findComment-1037394 Share on other sites More sharing options...
svgmx5 Posted April 5, 2010 Author Share Posted April 5, 2010 well thanks... i posted it here..because its under JavaScript help..but i am looking at other places as well Quote Link to comment https://forums.phpfreaks.com/topic/197674-showing-and-hiding-a-div-block/#findComment-1037395 Share on other sites More sharing options...
taquitosensei Posted April 5, 2010 Share Posted April 5, 2010 I thought I was looking at the php forums when I posted that....thus my edit. Quote Link to comment https://forums.phpfreaks.com/topic/197674-showing-and-hiding-a-div-block/#findComment-1037402 Share on other sites More sharing options...
svgmx5 Posted April 5, 2010 Author Share Posted April 5, 2010 ohh oops, sorry i didn't see the edit either way its cool Quote Link to comment https://forums.phpfreaks.com/topic/197674-showing-and-hiding-a-div-block/#findComment-1037409 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.