nimi
nimi

Reputation: 5507

how to call a page in iframe when clicking hyperlink?

I have a left pane with 5 items as hyperlink. When i click on the hyperlink, i wanna display corresponding item description in the right hand side. I am developing the website using html. By default there will be some description. when i click on item1, i wanna display the details of item1 and click on item2 i wanna display item2's details.

How can do this? Can i display the page in the iframe or something? what is the best practice?

Upvotes: 0

Views: 3881

Answers (2)

Codemwnci
Codemwnci

Reputation: 54884

If you want to use an IFrame, then you can do so, and just set the target of the hyperlink to be the name of the iFrame.

However, iFrames are considered bad practice. What would be better, is to use JQuery and use the load command.

For example, if your right hand pane has an id of right-pane:

<a href="showItem('item1-details.html')">item 1</a>

function showItem(url) {
    $('#right-pane').load(url);
} 

Upvotes: 1

finneycanhelp
finneycanhelp

Reputation: 9248

You use the target attribute. :)

http://www.w3schools.com/HTML/html_frames.asp

Upvotes: 0

Related Questions