deepson2 Posted June 5, 2009 Share Posted June 5, 2009 Hello, I am working on hide/show login panel. it seems got stucked with my JS function. using this function showall/hideall function is necessary. besides that i want to show my user name and passwords textboxes at time not sea pertly. can anyone please guide me. how can i achieve this? here is my js code. function elemOn(elem_id){ if(document.getElementById(elem_id)) document.getElementById(elem_id).style.display = "block"; } function elemOff(elem_id){ if(document.getElementById(elem_id)) document.getElementById(elem_id).style.display = "none"; } function hideAll(){ for( var i = 1; i <= 4; i++ ) elemOff( 'div'+i ); } function showAll(){ for( var i = 1; i <= 4; i++ ) elemOn( 'div'+i ); } function showOne(elem_id){ hideAll( ); elemOn( elem_id ); } and here is my php code <fieldset> <a href="javascript:showOne('div1');">Login</a> <div class="row"> <label for="username">Username</label><input type="text" name="username" id="username" value="<?=$username;?>" title="Enter your username" size="9" class="textboxfield" /> <label for="passwd">Password</label> <input type="password" name="passwd" id="passwd" title="Enter your Password" value="<?=$passwd;?>" size="9" class="textboxfield" onkeypress="javascript: return specChar(event); maxlength=15" /> </div> </fieldset> when i keep both the text boxes then this function is not working. while if i keep only one texbox its working. any help will be appreciated thanks in advance. Link to comment https://forums.phpfreaks.com/topic/161038-showhide-login-form-issue/ Share on other sites More sharing options...
PFMaBiSmAd Posted June 5, 2009 Share Posted June 5, 2009 Showing or hiding a login form is not really something you dynamically do using javascript in the browser because the browser and javascript don't directly know if the visitor is logged in or not. You do this using server side script by only outputting the log in form if the visitor is not logged in. Link to comment https://forums.phpfreaks.com/topic/161038-showhide-login-form-issue/#findComment-849872 Share on other sites More sharing options...
deepson2 Posted June 5, 2009 Author Share Posted June 5, 2009 Thanks for your reply PFMaBiSmAd, I just don't want user to go to login.php page. if he/she wants to log in on index page just clicking on login link they can see this two text boxes and over there only they can do their log in. just like digg.com earlier had. i dont know the other sites. I think, this can be done using java script only. kinda of new to JS/AJAX. please help me. Link to comment https://forums.phpfreaks.com/topic/161038-showhide-login-form-issue/#findComment-849875 Share on other sites More sharing options...
PFMaBiSmAd Posted June 5, 2009 Share Posted June 5, 2009 Login links, login forms, logout links, Welcome: username messages and any other content on a page that changes depending on if a visitor is logged in or not, is not done using javascript. It is done using server side script to control what is output depending on if the visitor is logged in or not. If you have a separate login page (I don't know why people do that instead of including a login/logout content "box" on any page that needs it), the log in page would test if the current visitor is logged in or not and only display the login form if he is not. Link to comment https://forums.phpfreaks.com/topic/161038-showhide-login-form-issue/#findComment-849879 Share on other sites More sharing options...
deepson2 Posted June 5, 2009 Author Share Posted June 5, 2009 Login links, login forms, logout links, Welcome: username messages and any other content on a page that changes depending on if a visitor is logged in or not, is not done using javascript. you are right but using JS/ajax we don't need to go to different page(login.php) we can do the login on that page(index page) itself. (besides its look good also... that what they said ) I have done this using thick boxes. but i don't want that. i want to do this using hide/show method. something like this. http://web-kreation.com/demos/login_form_mootools_1.2/ Link to comment https://forums.phpfreaks.com/topic/161038-showhide-login-form-issue/#findComment-849888 Share on other sites More sharing options...
deepson2 Posted June 6, 2009 Author Share Posted June 6, 2009 Any help????? Link to comment https://forums.phpfreaks.com/topic/161038-showhide-login-form-issue/#findComment-850428 Share on other sites More sharing options...
RichardRotterdam Posted June 6, 2009 Share Posted June 6, 2009 Looking at example it seems you just want the slidein effect. That effect on the link you gave uses mootools framework. here's the link Fx.Slide Link to comment https://forums.phpfreaks.com/topic/161038-showhide-login-form-issue/#findComment-850429 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.