View Full Version : linking html to html to iframe

04-14-2011, 10:09 AM
hi to all...
i'm a newbie in HTML stuff and now im building my first website however i have this problem encountered..

does anybody know how to link an html to another html w/ iframe?
confusing eh?

well to illustrate i have this "index.html" and i use
<a href="page2.html">go to item2</a>
to go to page2.html.

inside the "page2.html" i have
<div class="frame">
<iframe ="sampleframe.html" ></iframe>

and inside the "sampleframe.html"
there are three <p> with an id of item1, item2,item3..

what i want is when i click the "go to item2" button from the index.html i would be redirected to the <p id="item2">sample sample </p> in sampleframe.html

i hope you could help me with this problem.. thanks a lot.

04-15-2011, 07:03 AM
I suggest you restructure your site like this, if it's your first site.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">




<!--#include virtual="/navigation.html" -->
<h1>Page 1!</h1>
<p>Hello World</p>


<li><a href="home.html">HOME</a></li>
<li><a href="page1.html">PAGE 1</a></li>
<li><a href="page2.html">PAGE 2</a></li>