Jump to content

[SOLVED] PHP click new include (might be javascript)


daveoffy

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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.