how to make the parent window blank during the onload?
When i type the URL in the browser the login.jsp gets evaluated and a child window(with diasabled toolbar ) is opened and the parent window gets closed.
wat i want is when i type the u开发者_运维问答rl in the browser and click go i dont want to display any information of login.jsp page to be dispalyed in the parent window.. i want only in the child window......
i dont have any idea of using another jsp...
can someone help me wit the code or ideas....
the code i hav written is pasted below.
Login.js file
function focus(){
window.onload=ifocus();
document.LoginFB.strUserid.value="";
document.LoginFB.strPassword.value="";
document.LoginFB.strUserid.focus();
}
function ifocus(){
if(!window.opener){
window.opener='top';
window.close();
window.open('http://localhost:8080/jsp/Login.jsp','tr','width=1250,height=700,toolbar=no,location=no,directories=no,status=no,menubar=no,hbar=yes,scrollbars=yes,copyhistory=no,scrolling=yes, resizable=yes');
}else{
return;
}
Login.jsp
<body onload=javascript:focus()>
I dont't get the dance with the onload functions, but i would do this:
function focus(){
if(!window.opener){
window.open('http://localhost:8080/jsp/Login.jsp','tr','width=1250,height=700,toolbar=no,location=no,directories=no,status=no,menubar=no,hbar=yes,scrollbars=yes,copyhistory=no,scrolling=yes, resizable=yes');
document.getElementsByTagName("body")[0].innerHTML = "";
//or
window.close();
//but then you may get an alert...
}else{ //child
document.LoginFB.strUserid.value="";
document.LoginFB.strPassword.value="";
document.LoginFB.strUserid.focus();
return;
}
}
<body onload=javascript:focus()>
精彩评论