IFRAME question

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
mjordan
Beginner
Beginner
Posts: 3
Joined: Mon Jan 05, 2004 8:01 am

IFRAME question

Post by mjordan »

Hi Have some JS

with(milonic=new menuname("Links")){
style=menuStyle;
aI("text=NEW Apache;url=http://www.apache.org;target=_new");
aI("text=iframe Apache;url=javascript:openIFrame('tempiframe','http://www.apache.org/')");
aI("text=iframe myfile;url=javascript:openIFrame('tempiframe','me.htm')");
aI("text=myfile;url=me.htm;target=tempiframe");
}

which plays around with IFRAME as in the sample
http://milonic.com/menusample.php?sampleid=11

the first one loads a new window...thats cool
the second one opens it in the iframe...thats cool
the third opens me.htm in the iframe...that cool
the fourth one opens a new window which I not sure why given that the target is the name of the IFRAME "tempiframe")

Any help would be appreciated. I have searched thru the forum already..

Regards
Mick
User avatar
fredlongworthhighschool
Mega Advanced
Mega Advanced
Posts: 362
Joined: Fri Jun 27, 2003 11:34 am
Location: Manchester, England.
Contact:

Re: IFRAME question

Post by fredlongworthhighschool »

mjordan wrote:Hi Have some JS

with(milonic=new menuname("Links")){
style=menuStyle;
aI("text=NEW Apache;url=http://www.apache.org;target=_new");
aI("text=iframe Apache;url=javascript:openIFrame('tempiframe','http://www.apache.org/')");
aI("text=iframe myfile;url=javascript:openIFrame('tempiframe','me.htm')");
aI("text=myfile;url=me.htm;target=tempiframe");
}
Is it because your last link doesn't have url=javascript:openIFrame in it?
Andy Davis
Web Designer & Smartboard Manager

Fred Longworth High School, Manchester, England.
mjordan
Beginner
Beginner
Posts: 3
Joined: Mon Jan 05, 2004 8:01 am

Post by mjordan »

Thanx Andy,

Just thought I could target the Iframe directly...obvioulsy not...thanx for you assistance

BTW...I use Frontpage to do my design and have noticed that the third menu
aI("text=iframe myfile;url=javascript:openIFrame('tempiframe','me.htm')");
doesnt display the contents of the iFrame when I select the menu item in "Preview"...i.e. I have to load the page into a browser before it will work

Thanx
Mick
User avatar
fredlongworthhighschool
Mega Advanced
Mega Advanced
Posts: 362
Joined: Fri Jun 27, 2003 11:34 am
Location: Manchester, England.
Contact:

Post by fredlongworthhighschool »

It's funny, I also use Iframes but I don't use the method you do. A typical link of mine is as follows:

Code: Select all

aI("text=July 2003;url=news/newsletter_july.htm;status=News for July 2003;target=fred")
Andy Davis
Web Designer & Smartboard Manager

Fred Longworth High School, Manchester, England.
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

Watch out for Frontpage, Mick. It's famous (or perhaps, infamous) for changing code behind your back. We've had users here reporting problems with it. Double-check your code (even more than usual!).
John
mjordan
Beginner
Beginner
Posts: 3
Joined: Mon Jan 05, 2004 8:01 am

Post by mjordan »

Thanx John (another "quality" M$ product) ;-)

Andy, I did check your code before I posted and it looked like my example 4
aI("text=myfile;url=me.htm;target=tempiframe");
was the same as yours so I couldn't understand why mine was loading a new frame

Cheers
Mick
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

You gotta have a frame or iframe somewhere on the page (or even another window) with its ID set to whatever you specify in the target. When the link is called upon, it will take the target and look for a frame, iframe, or open IE window with that ID, and load the URL in that. If it cannot find a match, it will open a new window and assign the window whatever was specified in the target. Hope that helps.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
Post Reply