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>
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>