View Full Version : Executing javascript in an offsite page
frijj2k
12-22-2003, 05:45 AM
Hi
I am hoping somebody could help me with this one.
I have a site based around frames. In the top frame I am using HVmenu as my drop down menu system. The actualy drop downs appear in the bottom frame. To make the menu in the top frame still work after a user has made a selection and the page has loaded in the bottom fram I have to add to the page that is loaded in the bottom a bit of inline javascript under body-onload.
The code is as follows...
<body onload="javascript:{if(parent.frames[0]&&parent.frames['banner'].Go)parent.frames['banner'].Go()}">
My problem came to light as I need to be able to display off-site pages in my bottom frame but I cannot add this code to the pages as I do not and cannot get access to them.
Does any1 know of a workaround for this or do I have to scrap my menu system?
Thank you for your time...
Dave
Willy Duitt
12-22-2003, 11:45 AM
Did you try:
target="banner"
(or whatever your target frame is)
To your links?
.....Willy
frijj2k
12-22-2003, 12:09 PM
Thanks for your response...
My pages are being displayed in the correct target frame.
I will give you a bit more information...
The HVmenu system allows me to specify a target frame for each page (which I have done)
The menu setup looks similar to the following...
var DocTargetFrame='content'; // Frame where target documents appear
Menu1=new Array "rollover:news_up.jpg:news_down.jpg","news.htm","",0);
The second line is repeated for all menu elements.
Now the menu system is executed from the top frame (called 'Banner')
Each document I link to from the menu must have the javascript in as given in the first post to pass control back to the menu system otherwise it will stop responding. This isnt a problem for my pages as I can add the code but I have links to off-site pages which still get displayed in the bottom frame (called 'content').
These off-site pages display in the frame fine but because they do not contain that line of code the menu system stops responding. The off-site pages are FusionBot search engine and eXtreme Tracking. The FusionBot uses a form with a button to submit the data whereas the eXtreme Tracking simply uses a link.
I need a way of executing that line of code when the off-site page has loaded but I'm not sure how to do it (If it is possible?!?)
Thanks for your help again - It is much appreciated.
Regards
Dave
Willy Duitt
12-22-2003, 12:16 PM
You'll have to post a link. :confused:
frijj2k
12-22-2003, 12:29 PM
Site isnt up on net yet....
gimme 5 mins and I will set it up quickly...
I will post the address once it is done.
Btw, Thanks for the quick response :)
frijj2k
12-22-2003, 01:06 PM
Righty..
The temporary address is: www.sure24.net/newsite/index.htm
You should be able to get all the files you need (I uploaded the lot) and I think (hope) that all the links are pointing to the correct places... (we'll see ;-)
Obviously the site is far from complete but the concept is there.
Please give it 5 mins as the last few files are uploading now.
Cheerz m8
Dave
Willy Duitt
12-22-2003, 01:23 PM
The off-site pages are FusionBot search engine and eXtreme Tracking. The FusionBot uses a form with a button to submit the data whereas the eXtreme Tracking simply uses a link.
Can you point out where these links are?
The Search feature on the left works and the results are clickable and load into the content frame. Although it does look rather odd to have two Sure banners.
Other than that, all the links seemed to work for me.
.....Willy
Jon Hanlon
12-22-2003, 05:28 PM
Even if you get the code right, the browser's security model won't let the code run across domains.
You cannot access frame objects that are in another domain.
(This means you can't execute functions in another domain.)
You can read about cross-frame security here (http://msdn.microsoft.com/workshop/author/om/xframe_scripting_security.asp).
If this security weren't enforced, you could modify pages within your frameset that originated from another site.
frijj2k
12-23-2003, 05:55 AM
Sorry for the late response... Had to leave work yesterday just after we spoke. Anywayz...
The Search feature on the left works and the results are clickable and load into the content frame. Although it does look rather odd to have two Sure banners.
Yeah.. but when the search has been performed, the menu system stops responding correctly... no more drop down or highlight.. :( If you click on a menu item instead and load that page, the menu continues to work.
As for the two logos... thats just because currently it is not finished and is linking the old web site pages into the frame... this will change! :)
Even if you get the code right, the browser's security model won't let the code run across domains.
So it looks like it is not possible... Now I have problems since I need to be able to link a whole load of off-site pages for the E-Commerce system... This means my whole menu system needs scrapping from the sound of things! :( Damn...
If anyone knows of a way round this I would be very happy otherwise it looks like I gotta scrap the menu...
Btw, does any1 know of another java/javascript menu system ( Free for commercial use or cheap? :) ) that I could use instead that will work accross frames?
Thanks for your help people....
Dave ;)
Willy Duitt
12-23-2003, 12:16 PM
Originally posted by frijj2k
Yeah.. but when the search has been performed,
the menu system stops responding correctly...
no more drop down or highlight.. :(
If you click on a menu item instead and load that page,
the menu continues to work.
Oh, OK, I see it now.
Ummm, Is your Search Engine loading the results into their
own frames? If so, your page would no longer be on top and
this would explain why your menu stops working. You can
try a frame busting script on your page to keep it on top.
You can also try looking thru Dynamic Drives Forums
to see if this question has been answered before.
Here (http://codingforums.com/showthread.php?s=&threadid=29959) is one article which seems to apply.
.....Willy
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.