Karuta’s ASP & M$ SQLserver

Dicas, códigos e outras coisinhas de meus estudos para não esquecer…

Transferir resultados de uma janela secundária para a principal

Posted by karuta em junho 11, 2008

Arquivo: pagina1.asp

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>
<html>
<head>
<title> Janela Principal </title>
</head>
<script>
function nome()
{
window.name=’pagina1′;
}

function AbrirJanela()
{
var DialogWidth  = 400;
var DialogHeight = 325;
window.showModalDialog(‘pagina2.asp’,””,”dialogHeight:” + DialogHeight + “px; dialogWidth:” + DialogWidth + “px; dialogTop: px; dialogLeft: px; edge: Raised; center: Yes; help: No; resizable: Yes; scroll: Yes; status: No; unadorned: Yes; “);
}
</script>
<body>
<%
response.write “Nome: ” & session(“nome”) & “<br>”
response.write “E-mail: ” & session(“email”) & “<br>”
response.write “Senha: ” & session(“senha”)
%>
<hr>
<a href=”javascript:nome(),AbrirJanela()”>Abrir Janela</a>

</body>
</html>

Arquivo: pagina2.asp
<%
if request(“cmd”) = “verifica” then
session(“nome”)  = request(“nome”)
session(“email”) = request(“email”)
session(“senha”) = request(“senha”)
response.redirect “pagina1.asp”
end if
%>
<html>

<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=windows-1252″>
<meta name=”GENERATOR” content=”Microsoft FrontPage 4.0″>
<meta name=”ProgId” content=”FrontPage.Editor.Document”>
<title>Página 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</title>
<script type=”text/javascript”>
function toupper(campo)
{
campo.value = campo.value.toUpperCase();
}

function Insere (digito)
{
// alert(digito.value);
document.form.senha.value=document.form.senha.value+digito.value;

}

function CheckForm ()
{
if (document.form.nome.value==””)
{
alert(“Informe o nome!”);
document.form.nome.focus();
return false;
}
else if (document.form.email.value==””)
{
alert(“Informe o email!”);
document.form.email.focus();
return false;
}

window.close();
return true
}
</script>
</head>

<body scroll=”no” bgcolor=”#C0C0C0″ topmargin=”0″ leftmargin=”0″>
<form action=”pagina2.asp?cmd=verifica” method=”post” name=”form” target=”pagina1″ OnSubmit=”return CheckForm();”>
<table border=”0″ width=”100%” height=”325″ cellspacing=”0″ cellpadding=”0″>
  <tr>
    <td width=”100%” height=”19″ bgcolor=”#808080″ valign=”top”>&nbsp;</td>
  </tr>
  <tr>
    <td width=”100%” height=”220″ valign=”top”>
      <table border=”0″ width=”100%”>
        <tr>
          <td width=”100%”><font size=”2″ face=”Verdana”>Nome:</font></td>
        </tr>
        <tr>
          <td width=”100%”><font size=”2″ face=”Verdana”><input type=”text” name=”nome” size=”44″></font></td>
        </tr>
        <tr>
          <td width=”100%”><font size=”2″ face=”Verdana”>E-mail:</font></td>
        </tr>
        <tr>
          <td width=”100%”><font size=”2″ face=”Verdana”><input type=”text” name=”email” size=”44″></font></td>
        </tr>
        <tr>
          <td width=”100%”><font size=”2″ face=”Verdana”>Senha:</font></td>
        </tr>
        <tr>
          <td width=”100%”><font size=”2″ face=”Verdana”><input type=”text” name=”senha” size=”44″></font></td>
        </tr>
        <tr>
          <td width=”100%” align=”center”>
  <%for i = 0 to 9%>
  <input type=”button” name=”caracter<%=i%>” value=”<%=i%>” onclick=”Insere(this)”>
  <%next%>
  </td>
        </tr>
        <tr>
          <td width=”100%” align=”center”>
  <%for i = 65 to 77%>
  <input type=”button” name=”caracter<%=chr(i)%>” value=”<%=chr(i)%>” onclick=”javascript:Insere(this)”>
  <%next%>
  </td>
        </tr>
        <tr>
          <td width=”100%” align=”center”>
  <%for i = 78 to 90%>
  <input type=”button” name=”caracter<%=chr(i)%>” value=”<%=chr(i)%>” onclick=”javascript:Insere(this)”>
  <%next%>
  </td>
        </tr>
        <tr>
          <td width=”100%”>
            <p align=”center”><font size=”2″ face=”Verdana”><input type=”submit” value=”Enviar”>&nbsp;
            <input type=”reset” value=”Limpar”></font></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width=”100%” height=”1″ bgcolor=”#FFFFFF” valign=”top”></td>
  </tr>
  <tr>
    <td width=”100%” height=”68″ bgcolor=”#808080″ valign=”top”>&nbsp;</td>
  </tr>
</table>
</form>
</body>

</html>

Deixe uma resposta

Preencha os seus dados abaixo ou clique em um ícone para log in:

Logotipo do WordPress.com

Você está comentando utilizando sua conta WordPress.com. Sair / Alterar )

Imagem do Twitter

Você está comentando utilizando sua conta Twitter. Sair / Alterar )

Foto do Facebook

Você está comentando utilizando sua conta Facebook. Sair / Alterar )

Foto do Google+

Você está comentando utilizando sua conta Google+. Sair / Alterar )

Conectando a %s

 
%d blogueiros gostam disto: