accordion link to iframe

177 views
Skip to first unread message

fastrix

unread,
Dec 16, 2009, 5:23:44 PM12/16/09
to mootool...@googlegroups.com

I'm tryin to call html content into an iframe from accordion button. I tried
this:

<div id="accordion">
<h3 class="toggler">Main1</h3>
<div class="element">
<h4> main1sub1.html images/main1sub1.gif </h4>
--
View this message in context: http://n2.nabble.com/accordion-link-to-iframe-tp4178346p4178346.html
Sent from the MooTools Users mailing list archive at Nabble.com.

fastrix

unread,
Dec 16, 2009, 6:03:30 PM12/16/09
to mootool...@googlegroups.com

sorry, i hit the wrong button.

i was saying that i tried this:

a href="content.html" target="myiframe"><img src="images/content1.gif"/

but doesn't work.

Anybody can help me please.
--
View this message in context: http://n2.nabble.com/accordion-link-to-iframe-tp4178346p4178549.html

Roman Land

unread,
Dec 16, 2009, 6:41:19 PM12/16/09
to mootool...@googlegroups.com
iframes are not AJAX (although they once were kind of ajax...)

Do you actuallt have an iframe element on your page?

Try reading this first: http://www.w3schools.com/TAGS/tag_iframe.asp
--
---
"Make everything as simple as possible, but not simpler."

- Albert Einstein

fastrix

unread,
Dec 16, 2009, 8:07:18 PM12/16/09
to mootool...@googlegroups.com

Thanks for the response Roman! Yes, i already know what an iframe is. I have
my accordion from mootools with 9 elements and "myiframe" in a main.html .
In mouseover, each accordion element displays an image in which i want to
click an load html content in the iframe.

It doesn't happend with the target="myiframe" function. Thats the problem.

This is the iframe code:

<iframe width="580" id="catalogos"
onload="calcHeight();"
src="europa0.html"
scrolling="No"
frameborder="0"
height="1"></iframe>

It's also resizable depending on the content:

<script type="text/javascript">
<!--
function calcHeight()
{
//find height
var the_height=
document.getElementById('myiframe').contentWindow.
document.body.scrollHeight;

//change height
document.getElementById('myiframe').height=
the_height;
}
//-->
</script>

and this is the code for the accordion element:

</div>
<h3 class="toggler">Element1</h3>
<div class="element">
<h4> second.html images/second.gif </h4>
</div>

Where the target doesn't work.

I hope you can help me. Thanks in advance!
--
View this message in context: http://n2.nabble.com/accordion-link-to-iframe-tp4178346p4179088.html

Roman Land

unread,
Dec 16, 2009, 8:21:29 PM12/16/09
to mootool...@googlegroups.com
I kind of understand what you are trying to do, but I guess the code you posted is not what you wanted me to see..

Few errors I see in your code, you need to have a "name" attribute for the iframe:
<iframe name="myIframe">
Then when you want to use it :
<a href="file.html" target="myIframe">click me!</a>

Also, assume this iframe:
<iframe name="myIframe" id="anIframe"></iframe>

you should use this code:
 document.getElementById('anIframe').contentWindow..
If you are using mootools, you can also use:
$("anIframe").contentWindow...

You should google "iframe tutorial" and complete few of these if you are having any other issues, this is really basic stuff

HTH

fastrix

unread,
Dec 16, 2009, 8:37:58 PM12/16/09
to mootool...@googlegroups.com

Thanks Roman!!! you saved me. I just put the iframe name besides the id and
now it's working!!!

Thanks a lot again.
:clap:

I kind of understand what you are trying to do, but I guess the code you
posted is not what you wanted me to see..

Few errors I see in your code, you need to have a "name" attribute for the
iframe:
<iframe name="myIframe">
Then when you want to use it :

file.html click me!

Also, assume this iframe:
<iframe name="myIframe" id="anIframe"></iframe>

you should use this code:

document.getElementById('*anIframe*').contentWindow..


If you are using mootools, you can also use:
$("anIframe").contentWindow...

You should google "iframe tutorial" and complete few of these if you are
having any other issues, this is really basic stuff

HTH

> --


> View this message in context:
> http://n2.nabble.com/accordion-link-to-iframe-tp4178346p4179088.html
> Sent from the MooTools Users mailing list archive at Nabble.com.
>

--
---
"Make everything as simple as possible, but not simpler."

- Albert Einstein
--
View this message in context: http://n2.nabble.com/accordion-link-to-iframe-tp4178346p4179192.html

Reply all
Reply to author
Forward
0 new messages