Log in

View Full Version : Resolved How to load a different page using iframes



Luigicamp
04-28-2009, 09:00 AM
Hello every one. I have a small problem with iframe.
A company allowed me to load their website within mine, so I thought I would use iframe. I would like to know if there is a way to automatically load their website in the iframe without having to click on the link.

I explain. Right now I have a page called services.html. In the body section I have a link to the other company that, when clicked, it loads their website within the iframe, like so:



<body>

<a href="http://www.othercompany.com/" target="iframe">Other Company</a>

<iframe frameborder="0" name="iframe" width="1024" height="100%" scrolling="no"></iframe>


</body>

Instead of having to click on the link to load their page in the iframe, I would like to know if I can have that done automatically, every time I go to my services.html page. I looked around in various forums and I found out about an "onload" option, but, after trying it out, I couldn't get it to work.

I hope my question was clear enough.
Thank you in advance for your help.

Luigi

Snookerman
04-28-2009, 10:47 AM
Give the iframe a src attribute:

<iframe src="http://www.othercompany.com/" frameborder="0" name="iframe" width="1024" height="100%" scrolling="no"></iframe>

Good luck!

Luigicamp
04-28-2009, 11:02 AM
It Worked!
So simple, and yet I couldn't put my fingers on it.

Thanks a lot :)

Luigi

Snookerman
04-28-2009, 11:46 AM
You're welcome Luigi, glad to help you.

Good luck with the site!