mdrawdy
09-27-2007, 08:27 PM
Hello - I'm trying to swap an image when a link is selected; however, I'd like the swapped image to have a link, as well. I've been able to accomplish the image swap like such:
<script type="text/javascript">
function changeIt(imageName,objName)
{
var obj = document.getElementById(objName);
var imgTag = "<img src='"+imageName+"' border='0' />";
obj.innerHTML = imgTag;
return;
}
</script>
<p><a href="../examples/example.html" target="ExampleIframe"
onclick="changeIt('../images/logo.gif','image1','http://www.example.com');">
Example 1</a></p>
I've defined "image 1" and placed it on the top of my page. My problem is that I want the changed images to have an href, as well. So, I want to click on text "Example 1", have the associated html display in my Iframe, while at the same time, changing an image at the top of my page (not the Iframe) and have that image clickable.
Any help is greatly appreciated.
Thanks!
<script type="text/javascript">
function changeIt(imageName,objName)
{
var obj = document.getElementById(objName);
var imgTag = "<img src='"+imageName+"' border='0' />";
obj.innerHTML = imgTag;
return;
}
</script>
<p><a href="../examples/example.html" target="ExampleIframe"
onclick="changeIt('../images/logo.gif','image1','http://www.example.com');">
Example 1</a></p>
I've defined "image 1" and placed it on the top of my page. My problem is that I want the changed images to have an href, as well. So, I want to click on text "Example 1", have the associated html display in my Iframe, while at the same time, changing an image at the top of my page (not the Iframe) and have that image clickable.
Any help is greatly appreciated.
Thanks!