Olá Pessoal!
Me ajudem por favor...
Sou iniciante, estou com a seguinte dúvida:
Minha página está assim:
Tenho uma página Principal, que divide a página em três frames: INFERIOR, SUPERIOR, CENTRAL. Conforme código abaixo:
Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>.:: Projeto ::.</title>
</head>
<frameset rows="100,*,20" frameborder="0" framespacing="0">
<frame src="Topo.aspx" name="superior" noresize scrolling="NO">
<frame src="corpo.html" name="central" marginwidth="0" marginheight="0" noresize scrolling="YES">
<frame src="rodape.aspx" name="inferior" noresize scrolling="NO">
</frameset>
<noframes>
<body style="margin-top: 0px; margin-left: 0px;">
</body>
</noframes>
</html>
Na página "CORPO.HTML" tenho dois outros frames, conforme codigo abaixo:
Código:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<frame name="Corpo" src="corpo.aspx" marginwidth="0" marginheight="0" noresize scrolling="YES">
<TITLE>Area de Trabalho do Projeto</TITLE>
<meta name="vs_defaultClientScript" content="JavaScript" />
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" />
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0" />
<meta name="ProgId" content="VisualStudio.HTML" />
<meta name="Originator" content="Microsoft Visual Studio.NET 7.0" />
</head>
<frameset border="1" frameborder="0" framespacing="0" cols="240,*">
<frame name="menu" src="menu.aspx" marginwidth="0" marginheight="0" noresize scrolling="YES">
<frame name="corpo" src="AreaTrabalho.aspx" marginwidth="0" marginheight="0" noresize scrolling="YES">
</frameset>
<body>
<form id="frmCorpo" />
</body>
</html>
Daí o que acontece.. no arquivo "Menu.ASPX", eu tenho o seguinte JS:
Código:
script type="text/javascript">
function cpg(p)
{
parent.corpo.location=p;
}
</script>
Ele desenha, qualquer página no FRAME Corpo (AreaTrabalho.ASPX)
Dentro do Menu, eu tenho um link que usa este JS, da seguinte forma abaixo:
Código:
- "javascript:cpg('Movimento/Certificado.aspx')"
Então a página "CERTIFICADO.ASPX" será desenhada no FRAME - AREATRABALHO.ASPX (CORPO).
Dentro da página "CERTIFICADO.ASPX" tenho um botão que chama a página "PESQEMPRESA.Aspx", através do seguinte javascript:
Evento do botão:
Código:
ScriptManager.RegisterStartupScript(UpdPnlPrincipal, UpdPnlPrincipal.GetType(), "PesqEmpresa", "openModal('../Cadastro/CadEmpresa.aspx', 665, 400);", True)
O JavaScript:
Código:
function openModal(pUrl, pWidth, pHeight) {
if (window.showModalDialog) {
return window.showModalDialog(pUrl, window,
"dialogWidth:" + pWidth + "px;dialogHeight:" + pHeight + "px");
} else {
try {
netscape.security.PrivilegeManager.enablePrivilege(
"UniversalBrowserWrite");
window.open(pUrl, "wndModal", "width=" + pWidth
+ ",height=" + pHeight + ",resizable=no,modal=yes");
return true;
}
catch (e) {
alert("Script não confiável, não é possível abrir janela modal.");
return false;
}
}
}
A função javascript acima está implementada assim:
Código:
function
openModal(pUrl, pWidth, pHeight) {
if (window.showModalDialog) {
return window.showModalDialog(pUrl, window,"dialogWidth:"+ pWidth+"px;dialogHeight:" + pHeight + "px");
} else {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite");
window.open(pUrl, "wndModal", "width=" + pWidth+ ",height=" + pHeight +,resizable=no,modal=yes");
return true;
} catch (e) {
alert("Script não confiável, não é possível abrir janela modal.");
return false;
}
}
}
A idéia é que na página "PesqEmpresa.aspx", a pessoa faça a pesquisa de uma lista de empresas, e nela tenha, para cada item listado do banco de dados, um botão "SELECIONAR", o qual deve carregar para um campo (texto) da página anterior (CERTIFICADO.ASPX, por exemplo), o "ID" do registro selecionado.
Na página "PesqEmpresa.aspx", coloquei os seguintes códigos:
Código:
jscript = "window.opener.document.forms['Certificado'].txbCnpjCpf.value = '" + "00.000.000/0001-00" + "';"
jscript = "window.opener.document.forms['Certificado'].txbCnpjCpf.value = '" + "00.000.000/0001-00" + "';"
' "parent.frames['" + "'corpo'" + "'].document.forms['" + "Certificado" + "'].txbCnpjCpf.value = '" + "00.000.000/0001-00" + "';"
jscript = "javascript:setvalorcampo(1,'txbCnpjCpf','12345678');"
jscript = "window.opener.document.location.href = '" + "'None.aspx'" + "';"
jscript += "window.opener.document.getElementById('txbCnpjCpf').value = '" + "00.000.000/0001-00" + "'"
'"'" + varCnpjCpf + "';"
'opener.document.NomeDoForm.submit();
'window.opener.forms["document.frmEnvia"].submit();
jscript = "window.opener.parent.frames['" + "'corpo'" + "'].forms['" + "'Certificado'" + "'].txbCnpjCpf.value = '" + "00.000.000/0001-00" + "';"
jscript = "window.opener.parent.corpo.document.forms.Certificado.txbCnpjCpf.value = '" + "00.000.000/0001-00" + "';"
jscript = "alert(top.opener.Text1.value);"
jscript += "alert(top.opener.forms['frmDefault'].Text1.value);"
jscript += "alert(self.opener.location.href);"
jscript += "alert(self.opener.document);"
jscript += "alert(self.opener.document.forms.length);"
jscript += "alert(self.opener.document.formname);"
jscript += "alert(self.opener.document.formname.elements.length);"
jscript += "alert(self.opener.document.formname.fieldname);"
jscript += "alert(self.opener.document.formname.fieldname.value);"
jscript += "window.close();"
Porém nenhum funcionou, dá a seguinte mensagem:
Objeto inválido ou Nulo!
Ou seja, é como se eu estivesse acessando nd.
SE PUDEREM ME AJUDAR, AGRADEÇO!!!
ABRAÇO!
CURIOSA!!!