I need help, HTML--i have two links, linkA & linkB--when clicking linkA -should display image1 and whn clicking linkB image2 should be displayed.
The trick is they must be displayed in one image tag.
any one who can help with that?
I would appreciate your help.

Recommended Answers

All 2 Replies

<img id='bigimage' src='image3.jpg' width=x height=y>
<a onclick="document.getElementById('bigimage').src='image1.jpg';">Image1</a>
<a onclick="document.getElementById('bigimage').src='image2.jpg';">Image2</a>

Left stuff out of that code above
clicking as it is will take whatever time to download the images before the image changes, when the link is first clicked

<html><head></head><body><!--bla bla bla -->
<img id='bigimage' src='image3.jpg' width=x height=y>
<a onclick="document.getElementById('bigimage').src='image1.jpg';">Image1</a>
<a onclick="document.getElementById('bigimage').src='image2.jpg';">Image2</a>
<!-- bla bla bla -->
</body>
<script type="text/javascript">
//<![CDATA[
<!-- 
image1 = new Image();
image1.src = "image1.jpg";
image2 = new Image();
image2.src = "image2.jpg";
//-->
//]]>
</script>
</html>

loads the images into the tif, after the page is fully displayed (preloading in the head is a bad idea delays page loading) so that when the link is clicked the image displays immediately
any number of images can be loaded into the tif
I think this is better

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.