The onclick function is not working properly as it is disabling all the links on the parent window even after I close it.
On closing the pop up window, the parent page links are not working anymore. Everything else is working fine.
My code is:-
function MyPopUpWin(message) {
var iMyWidth;
var iMyHeight;
//half the screen width minus half the new window width (plus 5 pixel borders).
iMyWidth = (window.screen.width/2) - (75 + 10);
//half the screen height minus half the new window height (plus title and status bars).
iMyHeight = (window.screen.height/2) - (100 + 50);
//Open the window.
var generator = window.open();
document.onclick=function() {
try{
generator.focus();
return false
}
catch(e){}
}
generator.document.write('<html><head><title>Pop uP</title>');
generator.document.write('<p style="color:#C52B27;">');
generator.document.write(message);
generator.document.write('</p>');
generator.document.write('</head><body>');
generator.document.write('<a href="javascript:self.close()"><img src="/img/save_orange.gif" border=0"> <\/a>');
generator.document.write('</body></html>');
generator.document.close();
}
After closing the window, the reference to it is not lost… and the
.focus()method does not fail.. so youtry/catchis not doing what you think..