Create dhtmlXCombo from function JavaScript in execution tim

Hi, i need add a dhtmlXCombo but when press a button such as show below, i save the dhtmlXCombo definition in a var ComboObj and this var send to function JavaScript eval(ComboObj); and show undefined, but the load XML is called for the function…!


function a(){

myNewRow     = document.getElementById(‘tablaDetalles’).insertRow(-1);


ComboObj = ‘var ComboObj_cuenta_id = new dhtmlXCombo(“ComboObj_cuenta_id”,“cuenta_id”,“346”,true,6);’;

ComboObj += ‘ComboObj_cuenta_id.enableFilteringMode(true);’;

ComboObj += ‘ComboObj_cuenta_id.loadXML("…/…/js/php/complete.php");’;

myNewCell        = myNewRow.insertCell(0);

myNewCell.className    = “medio”;

myNewCell.align    = “left”;

myNewCell.innerHTML    = eval(ComboObj);


In IE , variables defined in “eval” visible only from inside the same eval, and still not accessible from outside.
You need to use global variable instead of local one, or use execScript instead of eval for IE