sabecs
asked on
Need to combine JavaScript funtions from 2 buttons
Hi,
How can I combine JavaScript functions from 2 buttons?
I would like my print button to have an alert "please note that the order details have not been processed yet, do you want to process this order now?"
and if they click ok then execute "if(checkFields()){locatio n.href='pr ocess_paym ent.php?ca rtId=<?php echo $cookie;?>'}"
I was also wondering if it is better to move location.href='process_pay ment.php?c artId=<?ph p echo $cookie;?> to the checkFields function and can I add an animated gif to this function?
How can I combine JavaScript functions from 2 buttons?
<input name="Submit" type="submit" onclick="javascript:window.print()" value="Print Details" />
<input type="button" class="button green" onClick="if(checkFields()){location.href='process_payment.php?cartId=<?php echo $cookie;?>'}" value="Process Order" >
I would like my print button to have an alert "please note that the order details have not been processed yet, do you want to process this order now?"
and if they click ok then execute "if(checkFields()){locatio
I was also wondering if it is better to move location.href='process_pay
<script language="JavaScript" type="text/javascript" >
//<!--
var clickcount = 0;
function checkFields(){
if (clickcount == 0) {
//count clicks
clickcount ++;
return true;
}
else {
alert("Transaction already in progress.. Please wait...");
return false;
}
}
//-->
</script>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
so you change location(url) of the page and during this order process you want to display a GIF.
if the GIF and Javascript is in the page and you change location of the page how this can be possible?
if the GIF and Javascript is in the page and you change location of the page how this can be possible?
@leakim971 i think he wants loader image till his clients click ok or cancel button.
@sabecs Please correct me if i am wrong
@sabecs Please correct me if i am wrong
ASKER
Regarding the animated gif, just wondering if there is a wait to display a message that the order is in progress which may take 10-20 seconds, I was wondering if I can display a div with an animated image inside it via a function?