I have this function:
function AbreGrupoCarencia(pTitulo, pTipo, pLinha, pCodigo, pCodTsContrato, pCodEntidadeTS, pNomeEntidade, pProtocoloAtendimento, pCodContratoAmpliado)
{
var txt_codigo = eval('document.form01.' + pCodigo + '.value');
//alert(txt_codigo);
if ( txt_codigo != '' ){
if ( parseInt(txt_codigo) <=0)
alert('Código inválido');
}
if ( txt_codigo == '' ){
alert('Código não informado');
return false;
}
var sAction = '../../cmp/asp/cmp0102a.asp';
sAction = sAction + '?cod_pesquisa=' + txt_codigo;
sAction = sAction + '&ind_tipo=' + pTipo;
sAction = sAction + '&cod_ts_contrato=' + pCodTsContrato;
sAction = sAction + '&cod_entidade_ts=' + pCodEntidadeTS;
sAction = sAction + '&nome_entidade=' + pNomeEntidade;
sAction = sAction + '&txt_protocolo_atendimento=' + pProtocoloAtendimento;
sAction = sAction + '&cod_contrato_ampliado=' + pCodContratoAmpliado;
sAction = sAction + '&PT=' + pTitulo;
AbrePesquisaCrossBrowser(sAction, pTitulo, pTitulo, 1000, 800, 50, 50, 'S');
}
What's happening. Well, the alert
commented at the beginning of the function, in IE
brings me 10 (in a situation) and in Chrome
, obeying the same criteria, brings me undefined
. The error is in this line: var txt_codigo = eval('document.form01.' + pCodigo + '.value');
. Scanning the code, I noticed that IE accepts getElementByID () even though there is no ID, only Name, but Chrome does not. If it is ID it must have ID (correct). Well, in the scan, I put ID for all elements that have only Name. This solved some problems, but I continue in this file, not working. It should display a popup window and nothing happens.