I have read a number of posts about this but none with any solid answer. Here is my code:
// button creation
onew = document.createElement(\'input\');
onew.
Use the addEventListener() function with "click
" for the type
argument for Mozilla-based browsers, and attachEvent() function with "onclick
" as the sEvent
argument for IE; I find it best to use a try/catch statement, for example:
try {
onew.attachEvent("onclick", //For IE
function(){fnDisplay_Computers("'" + alines[i] + "'"); });
}
catch(e) {
onew.addEventListener("click", //For Mozilla-based browsers
function(){fnDisplay_Computers("'" + alines[i] + "'"); },
false);
}