March 3, 201016 yr Hi there, I am trying to create a combined login/register box using tabs to switch between. I have used Javascript to switch the tabs but I just seem to be getting two boxes on top of each other :S Could you please point out where I am going wrong? Thanks. Here is my code: <script language="javascript">if (box == "login") {</script> <div class="login"> <p align="center" class="style15">Login</p> <form id="form1" name="form1" method="post" action="login.php"> <label><span class="style11"> Username:</span> <br /> <input type="text" name="user" id="user" /> </label> <label><span class="style11"> Password:</span> <br /> <input type="password" name="pass" id="pass" /> </label> <label><br /> <input type="checkbox" name="remember" id="remember" /> <span class="style14">remember me</span> </label> <br /><br /> <div align="center"> <input type="submit" name="Submit" id="Submit" value="Submit" /> </div> </form> </div> <script language="javascript">} else if (box == "register") {</script> <div class="login"> </div> <script language="javascript">}</script> <div id="logintab" onclick="document.getElementById('logintab').style.background-image='url(Images/tab_on.png)'; document.getElementById('registertab').style.background-image='url(Images/tab_off.png)'; var box='login';"> </div> <div id="registertab" onclick="document.getElementById('registertab').style.background-image='url(Images/tab_on.png)'; document.getElementById('logintab').style.background-image='url(Images/tab_off.png)'; var box='register';"> </div>
March 3, 201016 yr Author Would it be better to accomplish this using html to load an almost identical page with the only difference being the alternate box. Or possibly even in flash?
March 3, 201016 yr Author I have been learning JQuery and realised that there is a tabs function which looks useful so I'll give that a try
Create an account or sign in to comment