View Full Version : Problems with Windows :(
Badman3k
09-13-2002, 05:22 PM
I have a window with the following script in it:
function archive(which) {
var popurl="archive/archive" + which + ".htm"
winpops=window.open(popurl,"","width=550,height=390,")
window.winpops.archiveno(which)
}
The argument 'which' is sent from a flash movie. The script works
perfectly upto the point it tries to run the script on the winpops window.
I want the interger of 'which', form the first script, to be the new value for the argument of the second script:
function archiveno(num){
alert ("This is archive #" + num)
}
I can't see why this isn't working, and i would be very grateful if someone would help me out.
Many thanks in advance,
Badman
Guardian23
09-13-2002, 05:41 PM
Seeing as 'which' is your files name as well as the number, it
is probably easier to just parse the value window.location.href,
although the other problem could be the result of the page not
being loaded fully before the function call is sent, but I think it's
more likely that the function called would react as if it were in the
parent window.
e.x.
"Mom" sends "Johnny" over to "Tim's" house, and calls him
at "Home", "Johnny" goes "Home" and does his thing, be it
the dishes or the laundry.
But I've never actually tried calling Johnny from Home when he's
at Tim's House.
Try parsing the window.location.href, or try using the setTimeout
command.
Guardian
PS. What happens when it doesn't work?
PSS. window.winpops is redundant, use winpops directly, you
already know that winpops exists, there shouldn't be a problem
there.
Badman3k
09-13-2002, 06:54 PM
Thanks Guardian,
Still no joy, unfortunately. I scraped the windows.winpops and just used winpops, but it still didn't work.
The whole idea is that in the flash movie i have several "archived" files, each with their own link. I then use the FSCommand to call the javascrpt in the main window, but rather than have several scripts each doing pretty much the same thing, i decided to have one script but with a different argument.
The script then opens the archivex.html file in a popup window without scrollbars etc, with a set width and height.
Once this is done the idea is to then have a script on the template file for the archives that get's the argument for the achiveno() script and then have this number displayed within the page, as part of the HTML, rather than an alert.
I'm still trying to parse the url, but not having any look either.
When it doesn't work it just comes up with "Error on page -- Object does not support property or method" on the line with the
winpops.window.archiveno(which).
I tried adding the line:
var lol = which
within the first script, but this didn't work either.
Have you (or anyone else for that matter:)) got any more ideas? I would be very very grateful for them.
Many thanks in advance,
Badman
p.s. if it would help to upload the site to a temporary site, I can arrange for that to be done.
adios
09-14-2002, 01:44 AM
You've left a trailing comma there - height=390,")...could be a problem. Otherwise...might try something like this:
function archive(which) {
archive.which = which;
var popurl="archive/archive" + which + ".htm"
winpops=window.open(popurl,"","width=550,height=390")
}
In the popup:
function archiveno() {
if (opener.archive.which)
alert("This is archive #" + opener.archive.which);
}
onload = archiveno;
Running it from the child avoids timing problems; the function (object) property archive.which is easily accessed.
Badman3k
09-14-2002, 01:35 PM
Thanks for your help!!
I've managed to get the thing working thanks to your help. Took me a while to get your script to work but I've done it and it's working great.:thumbsup:
Thanks alot,
Badman
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.