|
-
May 23rd, 2002, 07:24 PM
#1
Thread Starter
Lively Member
Javasript Frame issues
Hi all, I am gonna make this real fast. Basically I can't get control of a frame that I want to change the location to.
Basically i have a document that creates two frames, one that maintains my url, and one that displays my page within the frame (called 'master'). Basically this format is used so that I can pass values and they won't be seen by the user.
Well my problem is that within the page that I am displaying I want to get control of that 'master' frame so that I can refresh my default page within it. I swore this was working for like two seconds, but for some reason it broke:
<script language='JavaScript'>top.master.location=default.htm'</script>
Any idea why it's not changing this location properly?
Last edited by cLocKwOrk; May 23rd, 2002 at 07:33 PM.
-
May 23rd, 2002, 10:18 PM
#2
did you try
<script language='JavaScript'>
parent.master.location=default.htm</script>
or
<script language='JavaScript'>
parent.frame(0).location=default.htm</script>
also I notice you have a ' in the end of the code by htm
-
May 24th, 2002, 12:09 AM
#3
You need to use the Parent method. This is used for frames only
-
May 24th, 2002, 03:31 PM
#4
Thread Starter
Lively Member
ok, well here is the thing.
I used to have a call where it was:
Code:
<script language='JavaScript'>
parent.parent.frames(0).location='default.htm'</script>
but this was before I got the frame named and later realized that this wasn't scalable across the different pages. (basically i am calling this from within a newsletter page which once they submitt their data the whole page gets refreshed... and this newsletter could be any number of frames deep).
and since I need this to scale across a bunch of different types of pages where I may be 3 frames deep (a frame in a frame in a frame)... or just one or 2 deep... so basically I just wanted to avoid having to specify how many parents it had to go up to refresh the whole page.
Ok well I kinda just shortened the call I am using... for simplicity sake... but basically all wcDCM.asp does is replace a couple web class variables and then display default.htm:
simple:
Code:
<script language='JavaScript'>top.master.location='default.htm';</script>
actual:
Code:
<script language='JavaScript'>top.master.location='wcDCM.asp?WCI=ItemDisplay&ID=###&Action=default';</script>
Basically its the same... at least with this frame issue.
Hope that is understandable.
I can do a "top.location=default.htm" BUT since I am using a couple frames (one to keep url and one to actually display the page) I can't just hit the "top" since then I will lose my url protection with the frameset.
Just in case it help... here is how I create the frameset:
Code:
<frameset cols="0,*" frameborder=0 framespacing=0>
<frame name="hid" border=0 scrolling=no marginwidth=0 marginheight=0 src="blank.htm">
<frame name="master" border=0 scrolling=no marginwidth=0 marginheight=0 src='<%="Template" & oRs("TemplateID") & "/wcDCM.asp?WCI=ItemDisplay&ID=" & oRs("pkid") & "&Action=default"%>'>
</frameset>
think of "<%="Template" & oRs("TemplateID") & "/wcDCM.asp?WCI=ItemDisplay&ID=" & oRs("pkid") & "&Action=default"%>" as basically default.htm.. since well... that's what it becomes after running through the web class stuff.
Hope I didn't make this more complicated.
Thanx to all!!!
-
May 24th, 2002, 03:41 PM
#5
and this newsletter could be any number of frames deep).
what are you talking about? you have only 2 frames. one that is hid and one that is master
it doesn't matter on the page that gets loaded they all go to master.
parent.frame[1].location will work. did you even try it?
or
parent.master.location
-
May 24th, 2002, 04:00 PM
#6
Thread Starter
Lively Member
ok... guess I'll have to go deeper into explaining what I am doing then. Uh.. so this newsletter is basically used across different templates which employ different styles of frame usage when displaying a web page. Some only use a top and bottom frame. Some create a left frame and a right frame... then the right frame creates the top and bottom frames within it... and within whichever frame... (as i said before... 1 frame deep, 2 frames deep... three frames deep... basically I don't want to care how many deep I am when i call this function [hence the killing of the parent.parent.frames(0) 'fix' which works for only 3 frames deep] and this is why I want to use TOP it's child name MASTER to access and refresh the page there).
Hope this all makes sense... I know it's a lot to take in and I'm not being the most forthcoming (u know... company specifics and all).
I thank you all for your patience and time.
-
May 28th, 2002, 05:25 PM
#7
Thread Starter
Lively Member
So no one has any idea? I mean if JavaScript would behave as it should this stuff seems to be super basic... but the "top" object doesn't seem to do what it advertises.
I tried all sorts of weird stuff for this bug. I basically just want to access the "top" object so that I can grab it's second child and change it's location, which should look like:
Code:
top.<frame name>.location="www.thisbugsux.com"
but this throws an error. I even tried:
Code:
top.frames(1).location="blah"
and this didn't throw an error, but it wasn't referencing the correct frame.
Code:
top.location="www.thisbugsux.com"
does what it should... but the only problem is that my little frameset becomes worthless and changing the location to that page makes my url hiding frameset worthless.
So again I ask... why doesn't this work:
Code:
top.<frame name>.location="www.thisbugsux.com"
I hope someone out there knows some little quirk to help out with this. It seems super easy... but isn't behaving properly... BAD JAVASCRIPT! BAD!
If you need more background into this bug you can look at:
http://www.vbforums.com/showthread.php?s=&threadid=168844
-
May 28th, 2002, 05:31 PM
#8
personally think you are getting confused with all this and frames. you seem to make it hard on yourself bu tI can give it one more shot.
top.frames.frame_name.location
-
May 28th, 2002, 06:43 PM
#9
Thread Starter
Lively Member
Man I was hoping that would work... but no dice. Well I am about to give up and just use the little hack method with parent.parent.frames(0).location
I'll just have to monitor which page is calling it two frames deep or three frames deep (i.e. more or less "parent" calls).
Thanks to all for your help... if anyone else has any insite I would greatly appreciate it.
Thanks again for everyones time.
Oh, and btw, if I didn't mention it... I tried every suggestion on the page so far... just in case you thought I might be ignoring suggestions. I tried them all. =(
Last edited by cLocKwOrk; May 28th, 2002 at 06:48 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|