Hi all,
I've written this simple function:
function projectWin(url,htmlName){
if (window.project) {
alert ("project window found");
if (project.location.href != url) {
alert ("wrong location - will change");
project.location.replace(url);
project.focus();
}
else {
alert ("correct doc is already there - focusing window");
project.focus;
}
}
else {
alert ("project window not found");
project
window.open
(url,htmlName,"width=300,height=303,scrollbars=no,resizable=no,to
p=5,left=5,screenx=5,screeny=5");
project.focus();
}
}
It's supposed to:
1. Check if a window is open.
2. If it is open, check the URL. If it's not the one in the argument,
change it and focus the window. If it's already the right URL, just focus
the window.
3. If it's not open, open it with the right URL.
I seem to have something wrong with the syntax when it comes to the
checking and changing the location,
as here's what is currently happening:
If the window does not exist it is created and given the correct argument
page.
If the window already exists, the script detects this.
If the right page is already in it, the script thinks it's the wrong one
and says it will replace it
- but it does not.
Same happens if the wrong page is in the window...
Would appreciate it if someone could check my syntax and help me get this
function working.
Thanks