Alex
Alex

Reputation: 11

One single Link that will open a seperate page and specific iframe

I got a situation here. I have a main page and a subpage. The subpage does have an iframe container and there are two pages test1.htm and test2.htm that are loaded into that iframe when your current page is "subpage.htm".

However, what I want to to, is to be able to click on a link on my main page and it opens up the subpage and automatically loads a predefined page, lets say test1.htm into the iframe.

I got the function to load a page into an iframe and I though by using JavaScript and some code this was possible. Unfortunately, I couldn't figure out a way to do this.

function link {
url = '../subpage.htm';
document.target = url;
loadintoiframe(myiframe,test1.htm);
}

I got the function loadintoiframe, it needs the name of the iframe and the page to load. When I call the function link() as a href link on the main page, it does load the subpage, but it does not load the iframe correctly.

Maybe someone can help me out?

Upvotes: 0

Views: 432

Answers (2)

Alex
Alex

Reputation: 11

So this does not work. I tried to go for a JavaScript Method that just does a href basically and then calls the method that loads my special page into that iframe on the href site.

That did not work, so anyone else got a clue how I can href a different .htm site and simultaniously tell that site to load a certain page into the iframe?

Best regards, Alex

Upvotes: 0

gonzofish
gonzofish

Reputation: 1417

Why not just put

<a href="test1.htm" target="iframeID">Link</a>

And avoid the JavaScript at all?

Upvotes: 0

Related Questions