Targeting into Iframe

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
Robert
Beginner
Beginner
Posts: 2
Joined: Mon Feb 06, 2006 2:48 pm

Targeting into Iframe

Post by Robert »

Well, I've searched everything I could find on your site about Iframes. The menu works fine, untill I try to set it up to target a page into an iframe, which doesn't work at all. At this point I've looked until my eyes are crossing, so I was hoping one of you folks could see what I'm missing.

Here is what I've used....

Just before body tag:

Code: Select all

</script></head>
<script>function openIFrame(mainframe, URL){
ifId=gmobj(mainframe)
ifId.location.href=URL // Opera Bug Fix. ifId.src=URL
} </script>
Placed in the page:

Code: Select all

<iframe id="mainframe" src="home.html" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow:visible; width:580px; display:none"></iframe
>
Link in js file:

Code: Select all

aI("text= About This Ministry;url=javascript:openIFrame('mainframe','aboutministry.html');");
Without the openiframe part of the link it works fine, but with it you get "error on page" down in the status bar and nothing happens.
If anyone has any ideas I would really appreciate it. Idon't have these pages uploaded yet, but if you need to see the whole thing in action I can upload the main and one of the linked pages.
Migru
Milonic Guru
Milonic Guru
Posts: 669
Joined: Tue Nov 01, 2005 8:22 pm
Location: Hamburg - Germany
Contact:

Post by Migru »

Hi

try as follows:

Code: Select all

<iframe src="home.html" id="_main" name="_main" height="400" width="580" frameborder="0" scrolling="auto"></iframe>
and in your js file

Code: Select all

aI("text= About This Ministry;url=aboutministry.html;target=_main;"); 
but if you need to see the whole thing in action I can upload the main and one of the linked pages.
This of course is always better (having a url)

Michael
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

I've also noted that on the Opening Windows and Frames samples, the code for opening the iframe is after the body tag, and is as follows:

Code: Select all

<script>
function openIFrame(iFrameId,winURL)
{
	ifId=gmobj(iFrameId)
	ifId.src=winURL
}
</script>
And, you do need to have both an id= and name= as Michael noted, some browsers need id, others need name= . I'm not sure which is which.

Ruth
Migru
Milonic Guru
Milonic Guru
Posts: 669
Joined: Tue Nov 01, 2005 8:22 pm
Location: Hamburg - Germany
Contact:

IFRAMES

Post by Migru »

Some links on this subject

a) page with adressing of iframes

http://milonic.com/forum/viewtopic. ... ght=#34525

b) Adressing iframes
reply by kevin on similar question ("id" and/or "name")

viewtopic. ... ght=#34126
or
http://milonic.com/forum/viewtopic. ... ght=#34057

HTML standard is to use both "id" and "name".

Michael
Robert
Beginner
Beginner
Posts: 2
Joined: Mon Feb 06, 2006 2:48 pm

Post by Robert »

Ok, thanks for the info. I'll go tinker on it some more.
Post Reply