Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Change between two images ?

Reply
Thread Tools

Change between two images ?

 
 
Jürgen Heyn
Guest
Posts: n/a
 
      02-13-2004
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>


 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
difference between change IP with Yast and change it with Static route in Linux z.s.n General Computer Support 0 08-21-2011 06:07 AM
PIL: Getting a two color difference between images Kevin D. Smith Python 4 10-27-2008 03:02 PM
how to change images based on action.Even clicking changed images should do respective actions? vj Javascript 3 01-12-2007 12:26 PM
A Paradise DNS address change? What change? There was no change. Tony Neville NZ Computing 7 09-22-2006 01:02 PM
Unnecessary spacing between two images in the same column of datagrid hrm ASP .Net Datagrid Control 4 05-30-2004 01:01 PM



Advertisments