Page 1 of 1
Check properties of one window from another?
Posted: Thu Jan 02, 2003 2:28 pm
by uberpolak
I'm trying to use a popup window (yes I hate them too, but the way I'm doing what I'm doing it's necessary) to determine the parent.location of the window it spawned from, does anybody know how I can do this? I'm not very good with JavaScript.
Posted: Thu Jan 02, 2003 2:40 pm
by Gen-ik
Hi.
In the pop-up window add this code..
Code: Select all
<script language="JavaScript">
my_parent=window.opener.location;
</script>
That should do the trick I think.
thanks
Posted: Thu Jan 02, 2003 3:12 pm
by uberpolak
That's the right object, thanks for your help, one more question though. Is there a way in Javascript to check for only part of a string, kind of like strstr() in PHP?
Posted: Thu Jan 02, 2003 4:10 pm
by Gen-ik
Yep.. I normally use this code to check for something within a piece of text..
Code: Select all
<script language="JavaScript">
this_text="check_for_BOB_in_this_text";
check_for="BOB";
if (this_text.indexOf(check_for)<0)
{
// Nothing has been found
}
else
{
// It has been found so do something here
}
</script>
Hope this helps.
Excellent
Posted: Fri Jan 03, 2003 10:03 am
by uberpolak
That's just what I needed, thanks!