daveoffy Posted January 2, 2009 Share Posted January 2, 2009 I have a login box on my website, I would like it so when people click SIgn Up (under login box) it replaces the login box with a signup form in the same spot where the login box is. I just need an example. For login box code just put [login box] and for sign up code put in [sign up]. Thanks for your help PHP Freaks! Link to comment https://forums.phpfreaks.com/topic/139228-solved-php-click-new-include-might-be-javascript/ Share on other sites More sharing options...
premiso Posted January 2, 2009 Share Posted January 2, 2009 You would want to use CSS/Javascript for this. Where onClick you hide the login and show the signup. This is pretty easy to do: <script type="text/javascript"> function showHide(hideid, showid) { var hideElement = document.getElementById(hideid); var showElement = document.getElementById(showid); hideElement.style.display = "none"; showElement.style.display = ""; } </script> <div id="loginForm"> <a href="#" onClick="showHide('loginForm', 'registerForm'); return false">Sign Up!</a> </div> <div id="registerForm"> <a href="#" onClick="showHide('registerForm', 'loginForm'); return false">Log In!</a> </div> Simple as that. Since this is not a JS form, I do not gurantee that will work, but that is the gist of it. Link to comment https://forums.phpfreaks.com/topic/139228-solved-php-click-new-include-might-be-javascript/#findComment-728262 Share on other sites More sharing options...
flyhoney Posted January 2, 2009 Share Posted January 2, 2009 Yeah this can be done easily with javascript. <div id="loginbox"> <!-- login form goes here --> </div> <div id="registerbox" style="display: none;"> <!-- register form goes here --> </div> <a href="#" onclick="toggleRegister(); return false;">Register</a> <script type="text/javascript"> function toggleRegister() { var register = document.getElementById('registerbox'); var login = document.getElementById('loginbox'); if ( register.style.display != 'none' ) { register.style.display = 'none'; login.style.display = 'block'; } else { register.style.display = 'block'; login.style.display = 'none'; } } <script> Link to comment https://forums.phpfreaks.com/topic/139228-solved-php-click-new-include-might-be-javascript/#findComment-728267 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.