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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

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.
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…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
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 …

825 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