Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:56

How to link to named iframe


Poster: warrenfab
Dated: Monday January 24 2005 - 20:43:21 GMT

I have the following problem;

A main page, for example "about.php".
On this page, there is an iframe, which has been given a name, example:

<iframe src="http://www.mysite.com/about_nuts.php" name="about" scrolling="no" frameborder="no" align="left" height = "190px" width = "500px"></iframe>

As one selects different items from the "about" menu, it should open the particular src page in the static page which never changes (in this case about.php). So you click on about_nuts.php and it loads into the iframe on the about.php page. If you click on "about_fruit.php" it opens that page in the iframe on the about.php page.

I hope the scenario sketched here is clear.

What I need to know is, how do I create the links and targets within the menu_data.js file? (assuming this is where I would change it).

Many thanks for any help forthcoming.

Warren


Poster: kevin3442
Dated: Monday January 24 2005 - 21:03:51 GMT

Hi Warren,

Probably the simplest thing to try would be to set the target property in the aI() string:
Code:
aI("text=About Fruit;url=about_fruit.php;target=about;");

Cheers,

Kevin

I've tried that, but here's what it does


Poster: warrenfab
Dated: Monday January 24 2005 - 21:17:10 GMT

Hi Kevin

I've tried that, but it opens the "about.php" page and the contents of "about_fruit.php" in the iframe space.

Any ideas?

Dumb Dumb Dumb


Poster: warrenfab
Dated: Monday January 24 2005 - 21:29:06 GMT

was all my fault....it works like a dream.

Thanks again Kevin, much appreciate the help.

Regards,
Warren :}

Drat, there's always something else


Poster: warrenfab
Dated: Monday January 24 2005 - 21:45:33 GMT

The "target=about" does not work for FireFox, it just opens the "about_nuts.php" page in a new window.

What do I do to get it to work in FireFox?

Thanks again,
Warren


Poster: kevin3442
Dated: Monday January 24 2005 - 21:51:22 GMT

Hi Warren,

Haven't really worked a lot with IFrames and Milonic, but there is a discussion in this sample page about it. It describes a function called openIFrame() that may work across all of your target browsers (again, I don't know for sure. But it's an alternative).

Cheers,

Kevin


Poster: Ruth
Dated: Tuesday January 25 2005 - 5:10:48 GMT

I'm not sure what exactly you are trying to do so, here are some suggestions:

1. if there is an iframe on each page and each has a different name
a. you can link to them if you are opening particular links on particular pages. Assume opening a particular link in the about.php
Code:
aI("text and so on; url=javascript:openIFrame('about','http://www.whateverurl.com/aboutus.php');
This would open the aboutus.php page in the iframe named about, if of course you're on the page that has the iframe named about.
b. if you have a differently named iframe on different pages and you want all the links to be able to open in any of those iframes I think you might have to have some kind of function that says something about if iframe named about, contact, home, inventory, sales, then assume name tempiframe. Sorry, I don't know function language. Anyway, you're trying to get it to read any iframe name and 'pretend' the name is tempiframe, then you would code all the links as javascript:OpenIframe('tempiframe and so on. I don't even know if that is possible.

2. You can name each iframe as tempiframe [or whatever name you choose] on all the pages and then javascript:OpenIframe('tempiframe etc. and the links would open in the iframe of whichever page you are on.

Also, you should not only have name=about but also id=about for the iframe identification. I think that might fix the FireFox issue [maybe]

You also need to have the iframe function in the head of the page

Code:
function openIFrame(IFrameID, URL){
   ifId=gmobj(IFrameID)
   ifId.location.href=URL // Opera Bug Fix. ifId.src=URL}


Finally, and I don't really understand the coding, but you might try naming the iframe about but using id=tempiframe for the javascript:OpenIframe code in the menu. I'm not sure you can name it one thing and have the id as another since I don't use iframes, but if that were the case it would mean you could id all iframes as one name and name each as what you want it to be?

Ruth