New to JavaScript so PLEASE bear with me. Trying hard to learn. My client specifically asked for a type of menu (scroll over a thumbnail and you see a large photo in the column next to it. And of course the thumbnail is clickable to new page. I am using this Jeremy Keith script:
/* This script and many more are available free online at
The JavaScript Source!! Created by: Jeremy Keith / Anonymous | */
function showPic(whichpic) {
if (document.getElementById) {
document.getElementById('placeholder').src = whichpic.href;
if (whichpic.title) {
document.getElementById('desc').childNodes[0].nodeValue = whichpic.title;
} else {
document.getElementById('desc').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
}
return false;
} else {
return true;
}
}
var previousToggle=null;
function toggleMe(a){
var e=document.getElementById(a);
if(!e)return true;
if(e.style.display=="none"){
e.style.display="block";
if(previousToggle)previousToggle.style.display="none";
previousToggle=e;
}
return true;
}
and it works fine, except that I can't figure out how to make it showpic on mouseover and still go to new URL (basic link to a page) onclick.
Here's a link (one of 8)in the body:
<a onmouseover="toggleMe('para1'); showPic(this); return false;" href="design.html.jpg" title="blah blah blah">
<img src="images/pix_smaller3.jpg" style="float:left" width="70" height="70"></a>
It either links to new page with the href="design.html", or swaps in larger pic if I href to the img file, but I can't seem to get BOTH to work. I obviously want the <a> to be to a new page, not the larger img. Shouldn't showPic take care of this? Where is showPic getting its imgs from?
I know that this can't be that complicated, but I have been up for 2 nights trying to figure this out. Any help appreciated...
/* This script and many more are available free online at
The JavaScript Source!! Created by: Jeremy Keith / Anonymous | */
function showPic(whichpic) {
if (document.getElementById) {
document.getElementById('placeholder').src = whichpic.href;
if (whichpic.title) {
document.getElementById('desc').childNodes[0].nodeValue = whichpic.title;
} else {
document.getElementById('desc').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
}
return false;
} else {
return true;
}
}
var previousToggle=null;
function toggleMe(a){
var e=document.getElementById(a);
if(!e)return true;
if(e.style.display=="none"){
e.style.display="block";
if(previousToggle)previousToggle.style.display="none";
previousToggle=e;
}
return true;
}
and it works fine, except that I can't figure out how to make it showpic on mouseover and still go to new URL (basic link to a page) onclick.
Here's a link (one of 8)in the body:
<a onmouseover="toggleMe('para1'); showPic(this); return false;" href="design.html.jpg" title="blah blah blah">
<img src="images/pix_smaller3.jpg" style="float:left" width="70" height="70"></a>
It either links to new page with the href="design.html", or swaps in larger pic if I href to the img file, but I can't seem to get BOTH to work. I obviously want the <a> to be to a new page, not the larger img. Shouldn't showPic take care of this? Where is showPic getting its imgs from?
I know that this can't be that complicated, but I have been up for 2 nights trying to figure this out. Any help appreciated...