Changing frame from one frame to another

JavaScript and client side scripting.

Moderator: General Moderators

User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

infolock wrote:i would recommend you look into using iFrames
No, my framing works fine. I just need to know how to return the value of the URL in the bottom frame. I don't think it's anything difficult, I am just not to familiar with javascript. I need the URL of top.frames[1].
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

sorry, misunderstood you...

Code: Select all

<html>
<head>
<script language=&quote;javascript&quote;>
var MyThing = window.parent.location;
document.write(MyThing);
</script>
</head>
</htmL>
of course instead of just document.write, you could point to a field in your frame, or just write it out on the frame itself...
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

well this link will be in the top frame. It will be a link containing the URL of the bottom frame.

so I'm not sure if window.parent.location would work, because I need the bottom frame..

would

Code: Select all

<a href=&quote;<script> var MyThing = window.top.frames&#1111;1].location; document.write(MyThing); </script>&quote; target=&quote;_blank&quote;>
work?
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

scrotaye wrote:well this link will be in the top frame. It will be a link containing the URL of the bottom frame.

so I'm not sure if window.parent.location would work, because I need the bottom frame..

would

Code: Select all

<a href=&quote;<script> var MyThing = window.top.frames&#1111;1].location; document.write(MyThing); </script>&quote; target=&quote;_blank&quote;>
work?
well, i only used parent.location as an example. what you would want to use is something along the lines of :

Code: Select all

var MyThing = parent.frames&#1111;1].location;
then you could do whatever you want with it.. alert with it, write it on the page, etc..

you should really do some homework on javascript. i'm not meaning that in a bad way by any means, just saying it's gonna help you out with this kinda thing. javascript is a very easy language to learn, and when you are gonna be dealing with window manipulation (like i can only assume you are gonna be doing based on this kinda question), knowing a little about javascript is only gonna help ;)
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

using parent.frames[1].location.href I keep getting the URL of my homepage of http://www.crazyexchange.net . However, the bottom frame is not even hosted on my site/server. However, when I use frames[0] I get the correct frame location of the top frame.

And could you point me towards some good javascript tutorials?
Post Reply