Solved

How do I select an iframe (from several) to display in a a div in a html page?

Posted on 2011-03-22
4
205 Views
Last Modified: 2012-06-21
I have a html page that contains a number of "a href" references that call up different pictures. However, the pictures display in a new window. I would like to display the pictures in the same div where the references are made. Maybe iframes is not the answer...
0
Comment
Question by:clenb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 30

Accepted Solution

by:
LZ1 earned 500 total points
ID: 35190264
Generally in the href you'll add a target like so:
<a href="www.google.com" target="_self"> Google </a>

You can see all of your options here: http://www.w3schools.com/tags/att_a_target.asp 

Do you have access to the iFrame content? If you do, then you can just add the target manually.  Otherwise you may also want to look into a fancybox or lightbox alternative:
 http://fancybox.net/
0
 
LVL 5

Expert Comment

by:rucky544
ID: 35190328
Use some Javascript

<head>
<script type="text/javascript">

function image(imagefile) {
	var img = document.createElement("IMG");
	img.src = imagefile;
	document.getElementById('image').appendChild(img);
        return false;
}
</script>
</head>

<body>
<div id="image"></div>
<div><a href="img/dir.gif" onclick="return image("img/dir.gif");">click to see image</a></div>
</body>

Open in new window


Something like that, to put the image into the image div.
0
 
LVL 16

Expert Comment

by:rbudj
ID: 35191320
iframe is depreciated. You should use <object>
0
 

Author Closing Comment

by:clenb
ID: 35326067
This was what I was looking for (fancybox)

Thank you,

Lennart
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remaiā€¦
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question