Feedback on: irt.org FAQ Knowledge Base Q428
Length:
Just right
Comments:
This code is not correct. There is an error in it. If I comment out the settimeout it opens a window....
Worth:
Worth reading
Length:
Just right
Technical:
Not technical enough
Comments:
hai,
The article was a useful one but still I have a problem.That is, I doesn't want a confirmation message before closing.How can I close the window without that message? Is there any way for it? Please help me.thanks in advance,
Prasanth
Worth:
Not worth reading
Length:
Technical:
Not technical enough
Comments:
I dont think this solution answered the problem so i will :)
If you want to only have 1 popup window open at once (i.e. if the user clicks a link which opens a popup, then clicks another link which is also going to open a popup) then you can do this to make sure the 2nd popup replaces the 1st:
<a href="#" onclick="window.close('myPopup'); window.open('someURLToAPage', 'myPopup', 'scrollbars=no, width=640px, menubar=no, toolbar=no, resizable=no');">click here for popup<a>
So basically you give all your popups the same name (myPopup in this case) so evertime you open a popup, you 1st call .close() on the popup and then open the new one.
Worth:
Worth reading
Length:
Just right
Technical:
Just right
Comments:
I tried the original code and got the error that the other person had. So I took out the backslashes before the single quotes. That worked for me.
<SCRIPT LANGUAGE="JavaScript"><!--
window.open("mywindow.htm","newwindow","width=725,height=125");
setTimeout('window.close()',5000);
//--></SCRIPT>
Then I wanted to get rid of the confirmation box. So I tried a suggestion from http://blogs.x2line.com/al/articles/350.aspx
I did not quite understand the reasoning but it works. Go to the link for the explanation. I needed to open a window to the application that did not have a menu system so I threw in a focus call to bring the new window to the front.
<SCRIPT LANGUAGE="JavaScript"><!--
NewWindow = window.open("mywindow.htm","newwindow","width=725,height=125");
NewWindow.focus();
window.opener = 'x';
setTimeout('window.close()',5000);
//--></SCRIPT>