?
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
?
207 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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
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.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

762 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