PDA

View Full Version : need help with combining 2 scripts



yonez
06-26-2007, 01:43 PM
Hi.

I'm not an native speeker so appologies made for bad grammar :-)

I have a function on my website where you change image by clicking on it.

<SCRIPT LANGUAGE="JavaScript"
TYPE="text/javascript">
<!--
if(document.images)
{
mitt=new Array()
mitt[0]=new Image()
mitt[1]=new Image()
mitt[2]=new Image()
mitt[3]=new Image()
mitt[4]=new Image()
mitt[5]=new Image()
mitt[6]=new Image()
mitt[7]=new Image()
mitt[8]=new Image()
mitt[9]=new Image()
mitt[0].src="mittensko0.gif"
mitt[1].src="mittensko1.gif"
mitt[2].src="mittensko2.gif"
mitt[3].src="mittensko3.gif"
mitt[4].src="mittensko4.gif"
mitt[5].src="mittensko5.gif"
mitt[6].src="mittensko6.gif"
mitt[7].src="mittensko7.gif"
mitt[8].src="mittensko8.gif"
mitt[9].src="mittensko9.gif"
nummer=1
}

function mittensko()
{
if(document.images)
{
document.mittenbyte.src=mitt[nummer].src
nummer++
if(nummer==mitt.length){nummer=0}
}
}
//-->
</SCRIPT>

and I also have lists where you can choose image

<TD>
<p>Välj tyg till mittendelen:</p>
</TD>
<TD>
<SELECT NAME="mitten">
<OPTiON>gul smalrandig manchester</OPTiON>
<OPTiON>grön smalrandig manchester</OPTiON>
<OPTiON>hallonröd smalrandig manchester</OPTiON>
<OPTiON>orange smalrandig manchester</OPTiON>
<OPTiON>cerise smalrandig manchester</OPTiON>
<OPTiON>turkos smalrandig manchester</OPTiON>
<OPTiON>rosa jeanstyg</OPTiON>
<OPTiON>vit lurv</OPTiON>
<OPTiON>svart lurv</OPTiON>
<OPTiON>grå lurv</OPTiON>
</SELECT>
</TD>

what I would like to do is to combain these two scripts so that when you choose an option the picture change or vise verse, ie when clickin the picture the option change.

anyone who knows how to do this and would like to help me a bit.

yonez
06-27-2007, 11:40 AM
If it is easier for you here is the webbsite so that you can see it in action www.villsjalv.se/sko.html

I'm thinking of if it is possible to use and (&&) in some way so that you have something like when they choose in the meny
if option lila then open picture maybe