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:18

Addressing an IFRAME

Poster: Migru
Dated: Sunday January 8 2006 - 2:26:11 GMT


I would like to get some more information on the addressing of iframes in combination with the menu.

In order to open the menu in an IFRAME you will need a custom JavaScript function. This function is very easy to integrate but it must be used in conjunction with the menu because it uses built in menu functions to get a reference to the IFRAME .
The function is called openIframe and it's parameters are IFrameID and URL

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

This you can find here:

With the actual release of the menu system the "targets" setting was

Encouraged by that I have recently set up a menu in an IFRAME, addressing a second IFRAME by using menu item "target" settings and specifying urls
url=file.html;target=_right; And there were no problems to do so. so far !!

Whereas it is recommended to use
I have used
(previously having defined the two iframes with names "_left" and "_right"; )

<iframe  src="Startupfile.html" name= "_right" height="580" width="620" scrolling="auto" frameborder="1"></iframe>

Pls. see:

I would like to know, if the IFrameID of the menu system corresponds directly with the standard definition of the <iframe> name=" " </iframe> property and if the mode I am using it (as described ) may cause problems. (So far everything went smoothly). Comments on that ?


Poster: kevin3442
Dated: Wednesday January 11 2006 - 1:43:10 GMT


IFrameID is more specifically the tag's id attribute, although the name attribute will work with some browsers, but only some. For example, if you only set the name attribute in the <iframe> tag (like in your example), then the function will not work with FireFox, but will with IE6. Best to cover all bases by setting both the name and the id attibute, to the same value. e.g.,

<iframe  src="Startupfile.html" name= "_right" id="_right" height="580" width="620" scrolling="auto" frameborder="1"></iframe>

You may also have better luck with the function if you change

ifId.location.href = URL;


ifId.src = URL;

Honestly, I haven't done a lot with targeting iframes from the menu (mainly when testing to help other people). But when I have used iframes, using the target property (as you have) has always worked. I believe that most users who target content in an iframe using the menu also have success using the target property. I'm not sure why the function actually exists, unless it was the only way to do it early in the development of the menu (that may be it... but it's been a long time ago and I can't recall for certain). It may have also had to do with cross-browser compatibility using iframes, but if so, I think the target property makes that a thing of the past (just my hunch).

Hope that helps,


Addressing iframes

Poster: Migru
Dated: Wednesday January 11 2006 - 7:24:18 GMT

Thank you,
in the beginning, i had both , an id and the name, with different values, made some tests with IE and FireFox, finally took out the id but after your comment I will return to my first version, but using both the "id" and the "name" property, as you suggested, with the same value !!.

Thank you for your post


Re: Addressing iframes

Poster: kevin3442
Dated: Thursday January 12 2006 - 10:50:25 GMT

Migru wrote:
Thank you for your post


You're welcome. Thank you Michael, for helping many other users. Well done!



Poster: speedfreak_be
Dated: Saturday February 25 2006 - 22:07:50 GMT


I've been using all possible ways for it to work, but it doesn't.

Can someone visit my site and tell me what I'm doing wrong. Both the classic and work-around versions don't work.

The target=_myiframe doesn't target my iframe but the whole window
The url=javascript:openIFrame method doesn't work at all.

Hope anyone can help as I'm really stuck with the site and the old one dissappears next month.

Poster: Ruth
Dated: Sunday February 26 2006 - 1:08:57 GMT


Can you post browser and OS with which the problem occurs? I just tried IE5.5 and FF1.2 and it works fine, I get a link in the little iframe.


Poster: Migru
Dated: Sunday February 26 2006 - 2:07:53 GMT


when i removed the id from the div,

id=maindiv1 it seems is not accepted by the menu.


(I have replaced

<DIV id=maindiv1 align=center><DIV id=maindiv2 style="WIDTH: 759px; POSITION: relative">

just with

<div align="center">, and took out one div end tag. )

Similar problem with position attribute:

Just wanted to let all you guys know that as Michael doubted the weared behaviour of the menu was because of position attribute value of div tags in different pages were set to either "absolute" or "relative".

After I got rid of position attribute of div tag, I needed to insert table's to postion the divs at the right place and every thing started working fine.

This comment you can find here:

Poster: speedfreak_be
Dated: Sunday February 26 2006 - 11:19:10 GMT

Thanks a lot Migru, oh my god, I've been trying and swearing for days already, the part of code that caused this is a leftover from the automatically generated code from the hosts page builder.

If I ever can repay you.

I'm using IE 6.00 with SP1 and doesn't work, neither in firefox 1.0.4

Thanks a lot for everyone.

Poster: Migru
Dated: Sunday February 26 2006 - 12:47:39 GMT


had, up to very recently , ff 1.04 installed,
but it is really important, particularly when you are using iframes and the milonic menu, to upgrade to ff 1.5 and request this from visitors of your site too! There are still some bugs with Opera, hopefully settled with Opera 9.


Poster: speedfreak_be
Dated: Sunday February 26 2006 - 18:29:08 GMT

Thanks, will do so.

It works like a charm now.

Been trying and swearing all week on this. :evil:

Poster: Migru
Dated: Sunday February 26 2006 - 20:24:35 GMT


you knwow, that you can place your main menu into a file (not the script tags), which you call for instance "embedded_main_menu.js" and then replace the code in your page by

<SCRIPT TYPE="text/javascript" src ="embedded_main_menu.js"></SCRIPT>


It facilitates editing / updating the menu !!