New Window
I have a new window popup being generated with an onClick event for a submit button. On unLoad of the page it closes the popup and redirects the user back to the same page. The reason for this is to display an animation that shows the user that progress is being made to upload their file.
What am I doing wrong?
Is there a better place to put these events? It works perfectly for IE 5+ but not for 4. I need this to work for both. The error I get on 4 is Newwindow is undefined. Newwindow is the name of the popup so on unLoad it can close it. IE 5 knows to ignore it if there is no popup, but 4 doesn't.
Any suggestions?
detox posted this at 13:41 — 2nd January 2002.
They have: 571 posts
Joined: Feb 2001
Sorry artsapimp
no-one seems to want to answer this question !
could you post your code or give us a URL?
artsapimp posted this at 15:35 — 2nd January 2002.
They have: 330 posts
Joined: Apr 2000
When I use it on my home PC (XP & IE6) it works great. When I tried it on my laptop (2k Server & IE5) it generates errors every time trying to find Newwindow which is the popup window. I assumed it was an IE issue and if IE5 had a problem with it IE4 would also. ... Not the case. I put it on my server at work (2k Server & IE4) and it works fine. I don't understand it, but I'm not complaining.
Thanks for your help anyway.
Here's the code if you're interested...
<script language="javascript">
function LaunchPopup() {
Newwindow=window.open("Uploading.htm","Newwindow",
"scrollbars=0, toolbar=0, status=0, menubar=0, resizable=0,
location=0, directories=0, width=200,height=150");
Newwindow.document.close();
}
function ClosePopup()
{
Newwindow.close()
}
function Toggle(id)
{
if(document.all[id].style.display == 'none')
{
document.all[id].style.display = '';
}
else
{
document.all[id].style.display = 'none';
}
}
</script>
</head>
<body onUnLoad="ClosePopup()">
Free Math Test
Fun Math Games
Suzanne posted this at 18:01 — 2nd January 2002.
She has: 5,507 posts
Joined: Feb 2000
Wow, that code causes massive scroll.
Anyway, you just need to test to see if Newwindow exists, for the closing function.
If Newwindow exists, then close it. Else do nothing.
That will resolve your errors.
Suzanne
artsapimp posted this at 20:04 — 2nd January 2002.
They have: 330 posts
Joined: Apr 2000
Yes, I'm sure that is all that I would have to do. I am not good enough at Javascript to know how to do that though. Any help you be appreciated.
Thanks for your help.
Free Math Test
Fun Math Games
Suzanne posted this at 23:05 — 2nd January 2002.
She has: 5,507 posts
Joined: Feb 2000
http://tech.irt.org/articles/js205/index.htm#8
I would personally wander over to irt.org and look it up.
Suzanne
Suzanne posted this at 23:11 — 2nd January 2002.
She has: 5,507 posts
Joined: Feb 2000
btw -- you have spaces in your JavaScript that may produce errors. There shouldn't be any spaces around the commas in the last section -- width=xxx,height=xxx,resizable=yes. Also, you should use "no" and "yes", not 0 and 1 for those.
The tutorials at irt.org will be of great help to you for learning how to control your popup windows.
Suzanne
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.