Connecting Tech Pros Worldwide Forums | Help | Site Map

Onchange function goes only once

bkaneweb
Guest
 
Posts: n/a
#1: Jun 14 '07
Hi,

I was working on a site that uses Google Checkout buy now buttons, and
I wanted the product picture to change based on what was picked. I was
able to have it change the picture, but if you pick a new item after
that, it keeps the same picture. Here;s the code:
The box (only the first part):

<form action="https://checkout.google.com/cws/v2/Merchant/
**************/checkout" id="BB_BuyButtonForm" method="post"
name="BB_BuyButtonForm" onchange="picchange()">
<table cellpadding="5" cellspacing="0" width="1%">
<tr>
<td align="right" width="1%">
<select name="buyButtonCart" "><form action="https://
checkout.google.com/cws/v2/Merchant/*************/checkout"
id="BB_BuyButtonForm" method="post" name="BB_BuyButtonForm"
onchange="picchange()">
<table cellpadding="5" cellspacing="0" width="1%">
<tr>
<td align="right" width="1%">
<select name="buyButtonCart" onchange="picchange()">

The function:

<script language="javascript" type="text/javascript">
function picchange()
{
var selecteditem =
document.BB_BuyButtonForm.buyButtonCart.selectedIn dex
if (selecteditem="0") {var picname = "Image0.png"}
if (selecteditem="1") {var picname = "Image10.png"}
if (selecteditem="2") {var picname = "Image0.png"}
document.images.pictures.src='/LICF/IMG/' + picname
var picname=""
}
</script>

The photo:
<img src="/LICF/IMG/products.jpg" name="pictures" width="196"
height="156" />

Any help would be great... Thanks!


bkaneweb
Guest
 
Posts: n/a
#2: Jun 14 '07

re: Onchange function goes only once


Never mind, I realized that I put only one "=" instead of "==".

Closed Thread