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
201 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
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
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 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)

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now