ho provato ad intuito a fare cosi
function addSmile(val,elm) {
document.getElementById(elm).value+=val;

}
ma non funziona ugualmente