PDA

View Full Version : changing images to multiple targets


raygaz
06-28-2003, 04:44 PM
I have an onMouseover change image script working in frames for one picture out of 6.
The problem is I don't know how to specify different targets for the other 5 pictures ( they are in a table in a line)
Do I need to put 'var' in somewhere?
I have tried numbering the altimg tag of the pictures but it didn't work ??
PLEEESE help someone.


In head:
</STYLE>
<script language="JavaScript">
<!-- Hide from old browsers


if (navigator.appVersion.indexOf("2.") != -1){
check = false;
}
if ((navigator.appVersion.indexOf("3.") != -1) && (navigator.appName.indexOf("Explorer") != -1)){
check = false;
}
else {
check = true;
}

image1alt = new Image();
image1alt.src = "doorcanopy2.jpg";
image1alton = new Image();
image1alton.src = "doorcanopy1.jpg";

image2alt = new Image();
image2alt.src = "roofing1.jpg";
image2alton = new Image();
image2alton.src = "roofing.jpg";

image3alt = new Image();
image3alt.src = "Mushroom1.jpg";
image3alton = new Image();
image3alton.src = "Mushroom.jpg";

image4alt = new Image();
image4alt.src = "fittedvanback1.jpg";
image4alton = new Image();
image4alton.src = "fittedvanback.jpg";

image5alt = new Image();
image5alt.src = "moulds1.jpg";
image5alton = new Image();
image5alton.src = "moulds.jpg";

image6alt = new Image();
image6alt.src = "ingroup1.jpg";
image6alton = new Image();
image6alton.src = "ingroup.jpg";

function imageon(name) {
parent.topFrame.document.altimg.src = eval(name + "alton.src");
}
function imageoff(name) {
parent.topFrame.document.altimg.src = eval(name + "alt.src");
}



NN3 = true;

function on(name) {
if (check == true){
imageon(name);
}
}
function off(name) {
if (check == true){
imageoff(name);
}
}
// -->
</script>

In body:

<div align="left">
<p><a href="page2.html" onmouseover="on('image1');" onmouseout="off('image1')" target="mainFrame"><font face="Arial" size="2" color="#FFFFFF">.</font><font face="Arial" size="2">Architectural
Features</font></a></p>
<p><font face="Arial" size="2" color="#006633"><a href="page3.html" onmouseover="on('image2');" onmouseout="off('image2')" target="mainFrame"><font color="#FFFFFF">.</font>Flat
Roofing</a></font></p>
<p><font face="Arial" size="2" color="#006633"><a href="page4.html" onmouseover="on('image3');" onmouseout="off('image3')" target="mainFrame"><font color="#FFFFFF">.</font>Shop
Fitting &amp;<br>
<font color="#FFFFFF">..</font>Cruise Liners</a></font></p>
<p><font face="Arial" size="2" color="#006633"><a href="page5.html" onmouseover="on('image4');" onmouseout="off('image4')" target="mainFrame"><font color="#FFFFFF">.</font>Specialist
Car &amp;<br>
<font color="#FFFFFF">.</font>Van Conversions</a></font></p>
<p><font face="Arial" size="2" color="#006633"><a href="page6.html" onmouseover="on('image5');" onmouseout="off('image5')" target="mainFrame"><font color="#FFFFFF">.</font>What
Is GRP?</a></font></p>
<p><font face="Arial" size="2" color="#006633"><a href="page7.html" onmouseover="on('image6');" onmouseout="off('image6')" target="mainFrame"><font color="#FFFFFF">.</font>Contact
&amp;<br>
<font color="#FFFFFF">.</font> Enquiries</a></font></p>

</div>
and in body where pics are to change (different frame)
<table width="626" border="0" height="85" align="left">
<tr>
<td width="182" height="44"><font color="#FFFFFF">..</font><img src="logo.jpg" width="154" height="58"><font color="#FFFFFF">.</font></td>
<td width="60" height="44"><img src="spacer.jpg"></td>
<td width="60" height="44"><img src="doorcanopy2.jpg" name="altimg" width="60" alt="Door Canopy"></td>
<td width="60" height="44"><a href="page3.html" target="mainFrame"><img src="roofing1.jpg" width="60" height="65" name="altimg1" border="0"></a></td>
<td width="60" height="44"><a href="page4.html" target="mainFrame"><img src="Mushroom1.jpg" width="60" height="65" name="altimg2" border="0"></a></td>
<td width="60" height="44"><a href="page5.html" target="mainFrame"><img src="fittedvanback1.jpg" width="60" height="65" name="altimg3" border="0"></a></td>
<td width="60" height="44"><a href="page6.html" target="mainFrame"><img src="moulds1.jpg" width="60" height="65" border="0" name="altimg4"></a></td>
<td width="64" height="44"><a href="page7.html" target="mainFrame"><img src="ingroup1.jpg" width="60" height="65" name="altimg5" border="0"></a></td>
</tr>

thanx:D

A1ien51
06-28-2003, 10:53 PM
you can specify what image by doing this

you just need to pass the NUMBER to it.


parent.topFrame.document.FormName("altimg" + NUMBER).src = eval(name + "alt.src");

raygaz
06-29-2003, 05:19 PM
Thanx so much, will try that
:thumbsup:

raygaz
06-29-2003, 07:07 PM
Sorry, but what do you mean 'pass the number to it'
am i writing the word NUMBER or putting a numeral somewhere, and where?
Have put the text in as you wrote it and it says' NUMBER is undefined'
Apologies for my lack of understanding, am new !!
thanx

RoyW
06-30-2003, 03:57 PM
function imageon(name)
{
parent.topFrame.document.images[name].src = eval(name + "alton.src");
}
function imageoff(name)
{
parent.topFrame.document.images[name].src = eval(name + "alt.src");
}


<table width="626" border="0" height="85" align="left">
<tr>
<td width="182" height="44"><font color="#FFFFFF">..</font><img
src="logo.jpg" width="154" height="58"><font color="#FFFFFF">.</font></td>

<td width="60" height="44"><img src="spacer.jpg"></td>

<td width="60" height="44"><img src="doorcanopy2.jpg" name="image1" width="60" alt="Door Canopy"></td>

<td width="60" height="44"><a href="page3.html" target="mainFrame"><img src="roofing1.jpg" width="60" height="65" name="image2" border="0"></a></td>

<td width="60" height="44"><a href="page4.html" target="mainFrame"><img src="Mushroom1.jpg" width="60" height="65" name="image3" border="0"></a></td>

<td width="60" height="44"><a href="page5.html" target="mainFrame"><img src="fittedvanback1.jpg" width="60" height="65" name="image4" border="0"></a></td>

<td width="60" height="44"><a href="page6.html" target="mainFrame"><img src="moulds1.jpg" width="60" height="65" border="0" name="image5"></a></td>

<td width="64" height="44"><a href="page7.html" target="mainFrame"><img src="ingroup1.jpg" width="60" height="65" name="image6" border="0"></a></td>

</tr>

raygaz
06-30-2003, 06:21 PM
Thanx a bunch:thumbsup: