javascript: prevent 2nd _blank window from opening in browser?

Katsutoshi

New Member
I'm using a javascript to launch a "shadowbox" jquery lightbox window when a user logs in and hits submit on a html form.firstly I want the jquery window to only launch on succesfull submit not on unsuccesful submit.(i.e so if the users email and password is correct) - is there a way to do this?The other problem im having is at the moment the jquery window pops up as expected but a 2nd target _blank window opens up at the same time because i am using \[code\]'this.target = 'formpopup';'\[/code\]i have tried to use \[code\]'e.preventDefault();'\[/code\] to prevent the second window from opening and this does stop the 2 window from opening but it also stops the form from login the user in. is there anyway i can just prevent the 2nd window from opening at all in a new _blank window without removing the \[code\]'this.target = 'formpopup';'\[/code\] as this is required for the jquery window to open up.please can someone show me what to do, thank you. HTML FORM:\[code\] <form id="myform" form action="login.php" method="post" class="loginform">Email <input type="text" name="email" maxlength="30" />Password<input type="password" name="password" maxlength="30" /><input type="image" src="http://stackoverflow.com/questions/PTB1/assets/img/icons/loginarrow1.png" name="submit" class="loginbutton" value="http://stackoverflow.com/questions/14522295/Login" /> </form>\[/code\]JAVASCRIPT:\[code\]<script> $(document).ready(function() { $('#myform').submit(function() { Shadowbox.open({ content: '<iframe src="http://stackoverflow.com/questions/14522295/loginin.php" width="500" height="300" scrolling="no" style="overflow:hidden; border:none;"></iframe>', player: "html", height: 300, width: 500 }); this.target = 'formpopup'; e.preventDefault(); });});</script>\[/code\]
 
Back
Top