I'm trying to create a page where is would work for both login and sign up at the same with by updating the the src of an iframe.
On the nav bar, I have this:
<li id="change"><a onclick="sign()">Sign up</a></li>
And on the iframe:
<iframe src="loginurl" id="frame"></iframe>
Then on the JavaScript, I have this
<script>
function sign(){
document.getElementById("frame").src="signupurl";
document.getElementById("change").innerHTML="<a onclick="login()">Login</a>";
}
function login(){
document.getElementById("frame").src="loginurl";
document.getElementById("change").innerHTML="<a onclick="sign()">Sign up</a>";
}
</script>
Its supposed to change the function it would execute onclick of the sign up link to login()
And the src of the iframe and vice versa