Kbase 19111: JavaScript: How to Determine the Value of a Submit Button
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  3/17/2003 |
|
Solution ID: 19111
GOAL:
JavaScript: How to Determine the Value of a Submit Button
FIX:
An example JavaScript that demonstrates how to test for the value of a submit button.
Sometimes it is necessary to do a test because the buttons might have the same name assigned to them.
Create a blank HTML document with the following code:
<html>
<head>
<title>Submit Button Test</title>
<script language="JavaScript">
function displayvalue(buttonchosen) {
alert(buttonchosen.value)
}
</script>
</head>
<body>
<form name="myform">
<input type="submit" name="mysubmitbutton" value="Button A"
onClick="displayvalue(this)">
<input type="submit" name="mysubmitbutton" value="Button B"
onClick="displayvalue(this)">
</form>
</body>
</html>