Targeting to iframe
Targeting to iframe
Hi,
if i want my links to open in iframe, how do I do that. Iframe is named as iframe.
Another question is about links. Do I put the complete url, http://www.mydomain.com/gallery.html or just /gallery.html
if i want my links to open in iframe, how do I do that. Iframe is named as iframe.
Another question is about links. Do I put the complete url, http://www.mydomain.com/gallery.html or just /gallery.html
In order to open the menu in an IFRAME you will need a custom JavaScript function. The function is called openIframe and it's parameters are IFrameID and URL
The function gets placed on the web page and then in the menu data file you'd code the aI string:
For more information on opening windows and frame see sample 11
Ruth
Code: Select all
function openIFrame(IFrameID, URL){
ifId=gmobj(IFrameID)
ifId.location.href=URL // Opera Bug Fix. ifId.src=URL
}
Code: Select all
aI("text=Open Google in IFrame;url=javascript:openIFrame('tempiframe,'http://www.google.com'")
Ruth
Still something to ask...

aI("text=Open Google in IFrame;url=javascript:openIFrame('tempiframe,'http://www.google.com'")
Where do I exactly place that??
And which parts of the codes do I have to replace with my own iframe names etc.
Thnx a lot, I think I´ll handle this after your reply.
And do I have to place complete url in links?
Hi,
Don't worry about it. My computer skills aren't that good either
OK, the function gets placed on the web page that has the iframe, just like it is, just copy and paste it. You said you named your iframe, iframe. I think you might want to change that, maybe tempiframe, or myiframe. I'm not a code person, but the function says things like openIFrame etc, so maybe you want to make the name different than iframe alone.
In the menu_data.js file you will have to 'call' the function in the aI string. You'll see all of the places you list your text and pages begin with aI. For the function to be called so the page will open in the iframe you put this in the url section So let's say the text on the menu is My Poetry, and the url is poems2u.com, and the iframe is named myiframe, the aI string would be:
Hope that helps.
Ruth
Don't worry about it. My computer skills aren't that good either

OK, the function gets placed on the web page that has the iframe, just like it is, just copy and paste it. You said you named your iframe, iframe. I think you might want to change that, maybe tempiframe, or myiframe. I'm not a code person, but the function says things like openIFrame etc, so maybe you want to make the name different than iframe alone.
In the menu_data.js file you will have to 'call' the function in the aI string. You'll see all of the places you list your text and pages begin with aI. For the function to be called so the page will open in the iframe you put this in the url section
Code: Select all
url=javascript:openIFrame('name of your iframe','http://address');
Code: Select all
aI("text=MyPoetry;url=javascript:openIFrame('myiframe','http://www.poems2u.com/');");
Ruth
Oh god, am I getting a headache
Back to basics:
1. function openIFrame(IFrameID, URL){
ifId=gmobj(IFrameID)
ifId.location.href=URL // Opera Bug Fix. ifId.src=URL
}
In which section of my page am I supposed to place that code and which tags must I use, <script>???
2. aI("text=MyPoetry;url=javascript:openIFrame('myiframe','http://www.poems2u.com/');");
That´s what you posted and this is from sample11:
aI("text=Open Google in IFrame;url=javascript:openIFrame('tempiframe,'http://www.google.com'")
I´ve found too many different ways and I really am confused now
EDIT:
Here´s what I got now between the body tags of my page;
<script>
function openIFrame(IFrameID, URL){
ifId=gmobj(IFrameID)
ifId.location.href=URL // Opera Bug Fix. ifId.src=URL
}
</script>
This is my Iframe:
<iframe
src="1joukkue.html" id="tempiframe" name="tempiframe"
frameborder="0" height="420" width="500"></iframe>
This is the link:
aI("text=Google;url=javascript:openIframe('tempiframe','http://www.google.com/');");


Back to basics:
1. function openIFrame(IFrameID, URL){
ifId=gmobj(IFrameID)
ifId.location.href=URL // Opera Bug Fix. ifId.src=URL
}
In which section of my page am I supposed to place that code and which tags must I use, <script>???
2. aI("text=MyPoetry;url=javascript:openIFrame('myiframe','http://www.poems2u.com/');");
That´s what you posted and this is from sample11:
aI("text=Open Google in IFrame;url=javascript:openIFrame('tempiframe,'http://www.google.com'")
I´ve found too many different ways and I really am confused now

EDIT:
Here´s what I got now between the body tags of my page;
<script>
function openIFrame(IFrameID, URL){
ifId=gmobj(IFrameID)
ifId.location.href=URL // Opera Bug Fix. ifId.src=URL
}
</script>
This is my Iframe:
<iframe
src="1joukkue.html" id="tempiframe" name="tempiframe"
frameborder="0" height="420" width="500"></iframe>
This is the link:
aI("text=Google;url=javascript:openIframe('tempiframe','http://www.google.com/');");
Sorry I forgot the script tags in front of and after the function which as I said gets put on the html page that has the iframe, I think you could put it in the head, or after the body tag. I assume it has to be before the iframe itself someplace though, so that it is 'working' before the iframe is loaded. I believe on the sample page it's in the middle of the page.
As to the different ways, they are not different ways, they are the same way, just different text, iframe names and urls. So, just make subsitutions for the text you have, the name of your iframe and the url you want to open in the iframe.
Make sure you have all the little ' and , and ( ) and ;
I used to get real frustrated when having to use a function because I would get overwhelmed with all the stuff in it that I didn't understand. I still can't write a function but someone explained one to me once and it helped to at least get me to understand some of the simpler ones, to at least find the name of the function and what it's supposed to do and it's parameters. In this one, its name is openIFrame, then in between the () it's telling you that you put the name of the iframe [whatever you have named it,] and the url you are going to open in that iframe, so what you are doing in the url section of the menu_data.js file is:
1. telling the menu that when the link is clicked it's going to use a javasript function url=javascript:
2. putting in the name of the function url=javascript:openIFrame
3. putting in the parameters of the function, those are the things listed between the ( ) url=javascript:openIframe('name of your iframe','page url you want to load');
If you still have trouble, please post the text you want to show in the menu, the name of your iframe, the url of the page you want to load into the iframe.
Hope this helps.
Ruth
Code: Select all
<script>function openIFrame(IFrameID, URL){
ifId=gmobj(IFrameID)
ifId.location.href=URL // Opera Bug Fix. ifId.src=URL
} </script>
Code: Select all
aI("text=Whatever Text You Want to Show on the Menu;url=javascript:openIFrame('the name of your iframe','the url of the page to open in the iframe');");
I used to get real frustrated when having to use a function because I would get overwhelmed with all the stuff in it that I didn't understand. I still can't write a function but someone explained one to me once and it helped to at least get me to understand some of the simpler ones, to at least find the name of the function and what it's supposed to do and it's parameters. In this one, its name is openIFrame, then in between the () it's telling you that you put the name of the iframe [whatever you have named it,] and the url you are going to open in that iframe, so what you are doing in the url section of the menu_data.js file is:
1. telling the menu that when the link is clicked it's going to use a javasript function url=javascript:
2. putting in the name of the function url=javascript:openIFrame
3. putting in the parameters of the function, those are the things listed between the ( ) url=javascript:openIframe('name of your iframe','page url you want to load');
If you still have trouble, please post the text you want to show in the menu, the name of your iframe, the url of the page you want to load into the iframe.
Hope this helps.
Ruth