I have two buttons (in OP2.0) with a standard form, but want the option for one of the two buttons to alter the data being sent. Both buttons are still sending original data (identical to Opt1)...and want to overwrite it when Opt2 is clicked.
<center><table><tr><td>
<p>
<img src="http://ift.tt/1YORnH0" alt="try now with text" width="358" height="110" style="cursor:pointer;" onclick="proceed();" value="Opt1"/>
</p>
</td><td width="40px"></td><td>
<p>
<img src="http://ift.tt/1JCTsdD" alt="30 off with text" width="346" height="110" style="cursor:pointer;" onclick="proceed();" value="Opt2"/>
</p>
</td></tr></table></center>
and javascript....
<script type="text/javascript">
function proceed(){
var chk=0;
jQuery('.test1').each(function(){
if(jQuery(this).is(':checked'))
{
chk++;
}
});
if(chk==1){
function setForm(Value){
if (value == 'Opt1'){
document.getElementById('price').value = '19.95'
document.getElementById('productId').value = '492'
document.getElementById('tagId').value = '3754'
document.getElementById('inf_custom_conversion').value = 'almanacupsell'
orderProcessUpsale()
}
if (value == 'Opt2'){
document.getElementById('price').value = '168.00'
document.getElementById('productId').value = '494'
document.getElementById('tagId').value = '3756'
document.getElementById('inf_custom_conversion').value = 'almanacupsell'
orderProcessUpsale()
}
}
orderProcessUpsale();
jQuery(".blackout").css("display", "block");
$('.blackout').css('cursor', 'wait');
unhook();
}
else
{
alert('Checkbox must be checked!');
jQuery("html, body").animate({ scrollTop: jQuery(document).height() }, 1000);
}
}
</script>
<script>
jQuery("#test1").on("change", function() {
if (jQuery(this).is(':checked')) {
jQuery('#test2').prop("checked", true);
} else {
jQuery('#test2').prop("checked", false);
}
});
</script>
<script>
jQuery("#test2").on("change", function() {
if (jQuery(this).is(':checked')) {
jQuery('#test1').prop("checked", true);
} else {
jQuery('#test1').prop("checked", false);
}
});
</script>
<script>
EnableSubmit = function(val)
{
var sbmt = document.getElementById("agree");
if (val.checked == true)
{
sbmt.disabled = false;
}
else
{
sbmt.disabled = true;
}
}
</script>
<script type="text/javascript">
jQuery(".btn2").on("click", function(){
jQuery('.btn2').css('cursor', 'wait');
});
</script>
Aucun commentaire:
Enregistrer un commentaire