function one(dir_icons) { ... element1.onclick = function() { ajouter_surprec(); } ... } function two() { ...create dynamic rows table }