Connecting Tech Pros Worldwide Help | Site Map

Change between two images ?

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 20th, 2005, 02:30 PM
Jürgen Heyn
Guest
 
Posts: n/a
Default Change between two images ?

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>



 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.