-
I am working on a small function to open a window, wait 2 seconds and then close the window, could someone tell me what they see wrong with the script. Because it is not working the right way.
function closeWin(){
newWin.close();
}
function makeWin() {
newWin = window.open("http://webcast.themeetingson.com/confluence.jsp?content=joinEvent.jsp&resvNum=17605812","","HEIGHT=1,WIDTH=1,hidden");
newWin.blur();
window.focus();
var timeID = setTimeout("closeWin()", 2000);
}
// ---------- END ---------------------
This window closes but it doesn't wait 2 sec to do it.
Thanks in advance.
-
I think your major problem is trying to use the var newWin
in the functions and across functions without declaring it outside of the functions try putting
var newWin = "";
above the two functions
-
Well I am not sure why though, but it does close if I call the function to close the window. But it does make sense to declare the variable.
-
Well it worked for me and the two-second delay worked for me also but I wrote the whole thing like this:
var newWin = "";
function closeWin(){
newWin.close();
}
function makeWin() {
newWin = window.open("http://webcast.themeetingson.com/confluence.jsp?content=joinEvent.jsp&resvNum=17605812","","HEIGHT=1,WIDTH=1,hidden");
newWin.blur();
window.focus();
setTimeout("closeWin()", 2000);
}
-
I am not sure what the problem is with me, but I used your code down to the key, BUT again it didn't work. This is really weird. Maybe I am doing something else different.
-
you got rid of the
var timeID =
before
setTimeout("closeWin()", 2000);
??
How are you calling the javascript?
-
Hey guys,
How about just using this code:
Code:
function makeWin() {
newWin = window.open("http://webcast.themeetingson.com/confluence.jsp?content=joinEvent.jsp&resvNum=17605812","","HEIGHT=1,WIDTH=1,hidden");
newWin.blur();
window.focus();
setTimeout("newWin.window.close()", 2000);
}
Of course, I don't see why freddy's cat's code wouldn't work.
aDog :cool:
P.S>-Due to a SandBox Security thing, a window can't be smaller than 100x100.
-
Good call Ariella, I am always trying to solve someones problem instead of looking for the obvious, which of course would be yours.
-
I have to apologise, It was working after all but I had the script set up a little different from what I was showing you.
I had a basic form that the user enters, it then error checks. Calls a function and that function is what I showed you and for some reason it did not work from that function but it does now.
So thanks again for looking into this. It really helped.