walkingseed
Technical User
I am having trouble catching events in Firefox. the below code works in Chrome but does not work in Firefox. How do I get the event target id in Firefox. I have been fighting this for far too long for as easy a problem as it should be and its got me frustrated.
// Attached listeners to the web page
function attach_events_obj() {
document.addEventListener('click',
function(){
do_click();
}, false);
}
// Process the click event
function do_click() {
// Determine if browser is IE or FF and get the event source element ID
var e_click = e_click || window.event;
var target = e_click.target || window.event.srcElement;
var obj_id = target.getAttribute('id');
// take action for the element that was clicked
if(obj_id == "people") {
document.frm_people.submit();
} else if(obj_id == "vendors") {
document.frm_vendors.submit();
}
}
// START HERE
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", attach_events_obj, false);
}
// Attached listeners to the web page
function attach_events_obj() {
document.addEventListener('click',
function(){
do_click();
}, false);
}
// Process the click event
function do_click() {
// Determine if browser is IE or FF and get the event source element ID
var e_click = e_click || window.event;
var target = e_click.target || window.event.srcElement;
var obj_id = target.getAttribute('id');
// take action for the element that was clicked
if(obj_id == "people") {
document.frm_people.submit();
} else if(obj_id == "vendors") {
document.frm_vendors.submit();
}
}
// START HERE
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", attach_events_obj, false);
}