troubleshooting Question

Simple detection of button clicked

Avatar of bowemc
bowemc asked on
JavaScript
9 Comments1 Solution2671 ViewsLast Modified:
Hi,

I'm running a javascript when <form id=onSubmit="return chk()">. What i want to do is detect which button has been clicked to cause the submit action. If its "ImageButton1" return true else if its "ImageButton2" contine and persom the rest of chk() whci is as below.

Thanks

function chk() {


  var val=document.getElementById("lblTotal").innerHTML;
var realVal=val.replace(/[b\<\>\€\/]/g,"");
var len = realVal.length;
var  val1 = realVal.substring(1,len);
var val2 = parseFloat(val1);
  if(val2>=25) {
    return true;
  }
  else {
    alert("You cannot proceed as your balance is less than E25.00. \nPlease select additional items before trying to proceed again. Thank you.");
    return false
  }
}

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 9 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros