Javascript Automated Click?

vgnheart

New Member
I have the following function for a jquery login form and want to run it when php detects that the user is not logged in by echoing a javascript function that clicks the login button automaticallyjq Code:\[code\]<script type="text/javascript"> $(document).ready(function() {$('a.login-window, a.log').click(function() { //Getting the variable's value from a link var loginBox = $(this).attr('href'); //Fade in the Popup $(loginBox).fadeIn(300); //Set the center alignment padding + border see css style var popMargTop = ($(loginBox).height() + 24) / 2; var popMargLeft = ($(loginBox).width() + 24) / 2; $(loginBox).css({ 'margin-top' : -popMargTop, 'margin-left' : -popMargLeft }); // Add the mask to body $('body').append('<div id="mask"></div>'); $('#mask').fadeIn(300); return false;});// When clicking on the button close or the mask layer the popup closed$('a.close, #mask').live('click', function() { $('#mask , .login-popup').fadeOut(300 , function() { $('#mask').remove(); }); return false;});}); </script>\[/code\]HTML\[code\] <div id="login-box" class="login-popup"> <a href="http://stackoverflow.com/questions/15603578/#" class="close"><img src="http://stackoverflow.com/questions/15603578/close_pop.png" class="btn_close" title="Close Window" alt="Close" /></a> <form method="post" method="post" name="f" id="f" class="signin" action="login.php"> <fieldset class="textbox"> <label class="username"> <span>Username or email</span> <input id="username" name="username" value="" type="text" autocomplete="on" placeholder="Username"> </label> <label class="password"> <span>Password</span> <input id="password" name="password" value="" type="password" placeholder="Password"> </label><button class="submit button" type="submit" name="Submit" value="http://stackoverflow.com/questions/15603578/<?php echo $lang['LOGIN'];" style="background:none;">Sign in</button> <p> <a class="forgot" href="http://stackoverflow.com/questions/15603578/#">Forgot your password?</a> </p> </fieldset> </form></div>\[/code\]
 
Back
Top