I have code below which changes price is the ‘price’ div to what the user selects.
<script type="text/javascript">
function showprice(e){
document.getElementById("price").innerHTML = e.getAttribute('data-price');
}
</script>
<img src="http://i.imgur.com/JnUKx.jpg" id="img1" onclick="showprice(this);" width="39" height="33" data-price="245.00">
<img src="http://i.imgur.com/c8Rwp.gif" id="img2" onclick="showprice(this);" width="39" height="33" data-price="255.00">
<div id="price" style="padding-bottom:10px"></div>
I have created 2 separate paypal buttons for each price. Both buttons are exactly the same but each have a different ‘value’. how can i change the ‘value’ depending on which image the user selects?
value for img1 button @ £245 is SKF4F8AARZWKE (code below)
value for img1 button @ £265 is WEI8F8HHJOPRY
paypal code for button img1 value SKF4F8AARZWKE
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="SKF4F8AARZWKE">
<input type="image" src="images/buyitnow.png" style="width:100px; height:30px" border="0" name="submit" alt="PayPal — The safer, easier way to pay online.">
</form>
Give the input element an id and use document.getElementById(‘YOUR_ID’).value = ‘YOUR VALUE’;