Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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
Medium Priority
?
209 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 2000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

609 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