Link to home
Start Free TrialLog in
Avatar of clenb
clenb

asked on

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

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...
ASKER CERTIFIED SOLUTION
Avatar of LZ1
LZ1
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
iframe is depreciated. You should use <object>
Avatar of clenb
clenb

ASKER

This was what I was looking for (fancybox)

Thank you,

Lennart