PDA

View Full Version : Pop up window and page redirection



letom
08-26-2012, 07:00 AM
The following script is for appearing a pop up window for user login,when user clicks a link login

In pop up window, When user clicks on Login button if it is with incorrect login details, the popup window get closed..

My question is can any thing do in this script for following.....


I want to stay in pop window if user entered incorrect login details by showing the error messages



If he is looged with correct login details i want to redirect the current page to "account.php" by closing the popup window.



I have php script for validation and user login.
Can any one suggest







<script type="text/javascript">

function loginopen(){
emailwindow=dhtmlmodal.open('EmailBox', 'iframe', 'login.php', 'My Account Area', 'width=550px,height=450px,center=1,resize=0,scrolling=0')

emailwindow.onclose=function(){ //Define custom code to run when window is closed
var theform=this.contentDoc.forms[0] //Access first form inside iframe just for your reference
var theemail=this.contentDoc.getElementById("emailfield") //Access form field with id="emailfield" inside iframe
if (theemail.value.indexOf("@")==-1){ //crude check for invalid email
alert("Please enter a valid email address")
return false //cancel closing of modal window
}
else{ //else if this is a valid email
document.getElementById("youremail").innerHTML=theemail.value //Assign the email to a span on the page
return true //allow closing of window
}
}
} //End "opennewsletter" function

</script>