Change between two images ?

J

Jürgen Heyn

Good evening,

I have problems to change between two images.
My project consits of 3 frames (Index.htm, Frame1.htm and Frame2.htm). In
the Index.htm I declared:

var PartNo = new Array();

var Checked = new Image();
Checked.src = "../Buttons/Checked.gif"; // Image1
var UnChecked = new Image();
Unchecked.src = "../Buttons/Blank16.gif"; // Image2

In Frame1.htm I have several forms. In form[0] I embedded an image. This
index of the image in the document is[1].
A graphical Button should switch from Image1 to Image2
<img src="../Buttons/Blank16.gif" border="0" width="16" height="16">
<input src="../Buttons/Button.bmp"
onClick=RefreshItems(this.form.elements[1].value) border="0" width="36"
height="36" type="image">

Unfortunately the following code does not work... ;( and I have no idea
what I did wrong.
I would greatly appreciate any hint. Thank you very much in advance.

Best regards
Juergen Heyn, Wilhelmshaven, Germany

<script language="JavaScript">
<!-- Beginn

function RefreshParts(pPartNo)
{
for(var i = 1; i <= document.forms.length; i++)
for(var j = 0; j <= parent.PartNo.length; i++)
if(parent.PartNo[j] == pPartNo)
{
SwitchImage(true);
break;
}
}

function SwitchImage(checked)
{
if(checked)
document.images[1].src=parent.Checked.src;
else
document.images[1].src=parent.Unchecked.src;
}

// End -->
</script>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top