Jump to content

Recommended Posts

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!

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.

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>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.