Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 6th July 2009. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2009 irt.org, All Rights Reserved.