crash41
03-12-2009, 01:00 AM
It's not so much a problem - i just can't figure out how to accomplish what we need.
I can't seem to explain this well - so i created an example of what i'm trying to do.
http://www.myvoicemusic.org/test/
If you rollover the 1, 2, or 3 - the image will change - as well as the main image. What i need to do is create links for the main image - but each 'version' of it needs to have a different link.
any ideas? This is the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
<body bgcolor="#999999" onload="MM_preloadImages('images/small1_o.jpg','images/small2_o.jpg','images/small3_o.jpg','images/large2.jpg','images/large3.jpg')">
<table width="548" height="497" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="400" rowspan="3"><img src="images/large1.jpg" name="main" width="400" height="400" id="main" /></td>
<td width="148" height="181"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image1','','images/small1_o.jpg',1)"><img src="images/small1.jpg" name="Image1" width="100" height="100" border="0" id="Image1" onmouseover="MM_swapImage('main','','images/large1.jpg',1)" onmouseout="MM_swapImgRestore()" /></a></td>
</tr>
<tr>
<td height="172"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image2','','images/small2_o.jpg',1)"><img src="images/small2.jpg" name="Image2" width="100" height="100" border="0" id="Image2" onmouseover="MM_swapImage('main','','images/large2.jpg',1)" onmouseout="MM_swapImgRestore()" /></a></td>
</tr>
<tr>
<td height="144"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image3','','images/small3_o.jpg',1)"><img src="images/small3.jpg" name="Image3" width="100" height="100" border="0" id="Image3" onmouseover="MM_swapImage('main','','images/large3.jpg',1)" onmouseout="MM_swapImgRestore()" /></a></td>
</tr>
</table>
</body>
</html>
I can't seem to explain this well - so i created an example of what i'm trying to do.
http://www.myvoicemusic.org/test/
If you rollover the 1, 2, or 3 - the image will change - as well as the main image. What i need to do is create links for the main image - but each 'version' of it needs to have a different link.
any ideas? This is the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
<body bgcolor="#999999" onload="MM_preloadImages('images/small1_o.jpg','images/small2_o.jpg','images/small3_o.jpg','images/large2.jpg','images/large3.jpg')">
<table width="548" height="497" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="400" rowspan="3"><img src="images/large1.jpg" name="main" width="400" height="400" id="main" /></td>
<td width="148" height="181"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image1','','images/small1_o.jpg',1)"><img src="images/small1.jpg" name="Image1" width="100" height="100" border="0" id="Image1" onmouseover="MM_swapImage('main','','images/large1.jpg',1)" onmouseout="MM_swapImgRestore()" /></a></td>
</tr>
<tr>
<td height="172"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image2','','images/small2_o.jpg',1)"><img src="images/small2.jpg" name="Image2" width="100" height="100" border="0" id="Image2" onmouseover="MM_swapImage('main','','images/large2.jpg',1)" onmouseout="MM_swapImgRestore()" /></a></td>
</tr>
<tr>
<td height="144"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image3','','images/small3_o.jpg',1)"><img src="images/small3.jpg" name="Image3" width="100" height="100" border="0" id="Image3" onmouseover="MM_swapImage('main','','images/large3.jpg',1)" onmouseout="MM_swapImgRestore()" /></a></td>
</tr>
</table>
</body>
</html>