document.getElementById('contactoF').onmouseover = function() { add(); }; document.getElementById('contactoF').onclick = function() { add(); }; function add() { input = document.getElementById('as'); if (input==undefined) { var input = document.createElement('input'); document.getElementById('contactoF').appendChild(input); } input.id = 'as'; input.type = 'hidden'; input.name = 'as'; input.value = 'fa219a92e9b8de1de72b3d142249340ef22b1d0fc5c3c0aa5f1d9d523b6ed331'; }