...

View Full Version : Popup window location



Turek
07-23-2002, 06:53 PM
hi, i have such a script for example:


function popup(redirection) {
winpopup=window.open("","winpopup","scrollbars,status=1")
winpopup.moveTo(50,50)
winpopup.resizeTo(790,400)
winpopup.location=redirection
}

and now is the problem to make, for example button onthe first page, and when i click on it an alert box apears with the url of the popup window...
i tried something like that:


alert(winpopup.location.href);

and


alert(winpopup.location);

and


alert(winpopup.document.location);

but always with an error..

any ideas why, or what i've done wrong??
thanks for replies

ACJavascript
07-23-2002, 07:21 PM
try this :D

-----

<script language="javascript">

function popup(redirection) {
alert(redirection)
winpopup=window.open(redirection,"winpopup","scrollbars,status=1")
winpopup.moveTo(50,50)
winpopup.resizeTo(790,400)
}

</script>

----


<input type="button" value="go" onclick="popup('http://www.codingforums.com')">




This what ya ment :D:D

Turek
07-23-2002, 07:45 PM
yes true, but i've not expected this... i should say it that way: popup opens with a page, when you click on button, and that page redirects somewhere, and now back to the first page, i click on button and it alerts me what link/url is now in that popup window.... just want to make script that tells me what url is currently in popup window...

adios
07-23-2002, 07:54 PM
Is the redirected file in the same domain as the page which opens it? What's the error message? How are you triggering the alert()?

Turek
07-23-2002, 08:22 PM
=> Is the redirected file in the same domain as the page which opens it?
nope
=> What's the error message?
it says in the status, script error :)
=> How are you triggering the alert()?
<script language="javascript">
...
function checkp() {
window.self.status = winpopup.location.href;
}
...
</script>
<input name=turek onclick=checkp(); type=button value=value>

OK i want to make something like that: the user enter my page there are two buttons: VOTE and ENTER, user click VOTE, the popup opens where he can vote, whith button inside, and now the script on first page should check if he clicked that button in popup window (check if popup window has url that is visited after clicking). after that ENTER button enables... i know how to do the rest of this, but i only need something that will check what url is now in popup window...

Turek
07-25-2002, 11:02 PM
.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum