Maybe the semicolon at the end would help
el.setAttribute("onkeypress","additemifenter(this.id);");
but
why don't you use the standard event handling model:
el.onkeypress = function(event){
// functionality
};
or
el.addEventListener("keypress",function(event){
// functionality
},false);
to check the keycode you must use the code:
var code = (event.keyCode) ? event.keyCode : event.which;
if(code == 13){
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…