RicksAtWork
Programmer
I have a method addEvent which wires up events.
//Set default submit handler to always return false, and therefore not submit the form.
document.getElementById('Form1').onsubmit=function(){return false;}
//The following code points all submit events at the method EventKernal
addEvent(document.getElementById('Form1'), 'submit', EventKernal);
In the function EventKernal, I want to determine which button was pressed which caused the submission.
The following code will only return a reference to Form1.
How can I detremine which button was pressed?
function EventKernal(e)
{
//Get event object and source element
eventObject = (e)? e:event;
//IE
originalObject = e.srcElement;
//Mozilla
if(originalObject == null)
{
originalObject = e.target;
}
alert(originalObject.id);
return false;
}
//Set default submit handler to always return false, and therefore not submit the form.
document.getElementById('Form1').onsubmit=function(){return false;}
//The following code points all submit events at the method EventKernal
addEvent(document.getElementById('Form1'), 'submit', EventKernal);
In the function EventKernal, I want to determine which button was pressed which caused the submission.
The following code will only return a reference to Form1.
How can I detremine which button was pressed?
function EventKernal(e)
{
//Get event object and source element
eventObject = (e)? e:event;
//IE
originalObject = e.srcElement;
//Mozilla
if(originalObject == null)
{
originalObject = e.target;
}
alert(originalObject.id);
return false;
}