How to call button event in javascript for cross browsers
function SubmitClick(bt) {
if (navigator.appName.indexOf("Microsoft Internet Explorer") > -1) {
bt.click();
return false;
}
else {
if (bt && typeof (bt.click) == 'undefined') {
bt.click = addClickFunction(bt);
return false;
}
else {
bt.click();
return false;
}
return false;
}
}
function addClickFunction(bt) {
var result = true;
if (bt.onclick) result = bt.onclick();
if (typeof (result) == 'undefined' || result) {
eval(bt.href);
}
}
if (navigator.appName.indexOf("Microsoft Internet Explorer") > -1) {
bt.click();
return false;
}
else {
if (bt && typeof (bt.click) == 'undefined') {
bt.click = addClickFunction(bt);
return false;
}
else {
bt.click();
return false;
}
return false;
}
}
function addClickFunction(bt) {
var result = true;
if (bt.onclick) result = bt.onclick();
if (typeof (result) == 'undefined' || result) {
eval(bt.href);
}
}
Comments
Post a Comment