|
Q265 If I have two identically named submit buttons, but with different values, how can I tell which one was pressed?
irt.org | Knowledge Base | JavaScript | Form 7.2 | Q265 [ previous next ]
Q265 If I have two identically named submit buttons, but with different values, how can I tell which one was pressed?
<SCRIPT LANGUAGE="JavaScript"><!--
var button = 0;
function test(val) {
button = val;
}
function check() {
alert('Button ' + button + ' pressed');
}
//--></SCRIPT>
<FORM onSubmit="check()">
<INPUT TYPE="SUBMIT" NAME="xxxx" VALUE="Button 1" onClick="test('1')">
<INPUT TYPE="SUBMIT" NAME="xxxx" VALUE="Button 2" onClick="test('2')">
</FORM>
|
|
|
Copyright © 1996-2008 irt.org, All Rights Reserved.