iframe alterando o form Principal

19/07/2012

0

Tenho o form principal (formPrincipal) com uma label, e dentro dele um iframe que mostra páginas conforme oque é clicado no php principal. Pelo frame gostaria de alterar a label (chamada test) do form principal. Como fazer sem dar reload (POST) na página?
Abaixo as tentaivas que não funcionaram (jQuery = $):

window.opener.document.getElementById(test).innerHTML=XXXXX;
window.document.getElementById(test).innerHTML=XXXXXXX;
window.parent.document.getElementById(test).innerHTML=XXXXXX;
document.getElementById(test).value=XXXXX;
document.getElementById(test).innerHTML=xxxxxx;
jQuery(window.parent.document).find(#test).text(XXXXXXX);
jQuery(document).parent().find(#test).text(xxxxx);
jQuery(.formPrincipal,window.opener.document).find(#test).html(XXXXX);
jQuery(document).find(#test).text(XXXXXXXX);
jQuery(#test,window.opener.document).val(XXXXXX);
jQuery(window.parent.document).find(#test).html(XXXXXX);
jQuery(#test, window.parent.document).html(XXXXX);
jQuery(this).parent().find(#test).text(XXXXX);
jQuery(#test).parent(.formPrincipal).html(XXXXXX);

Qualquer ajuda é bem vinda.
Muito obrigado.
Pablo Botton.

Pablo Botton.

Responder

Posts

10/08/2012

Thiago Palmeira

Tenta usar o iframe do HTML mesmo...
Responder

10/08/2012

Pablo Botton.

Desculpa amigo, não entendi. Pode me dar um exemplo?
Muito obrigado.
Responder

15/08/2012

Pablo Botton.

Segue o HTML Pai (pai.html):

!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
html 
 head
  titleTITULO/title
  link rel=stylesheet href=my.css /
  script src=https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js/script
  script src=my.js/script
 /head
 body
  div data-role=page id=pai data-fullscreen=true
   div data-theme=a data-role=header data-position=inlineCABECALHO/div			
   div data-role=content 
    div id=lblfun_outer 
     div id=lblfun style= font-family: Tahoma; font-size: 11px; cursor: default;height:13px;width:80px; TESTE/div
    /div
    div id=conteudo_outer 
     div id=conteudo_wrapper style=width:100%;height:100%;overflow:auto; 
	  iframe style=width:100%;height:100%;position:absolute; src=teste.html  name=conteudo id=conteudo  marginwidth=0 marginheight=0 frameborder=0  scrolling=nos /iframe
     /div
    /div
   /div
  /div
 /body
/html


E o html filho (teste.html):

!DOCTYPE html
html
 head
  link rel=stylesheet href=https://ajax.aspnetcdn.com/ajax/jquery.mobile/1.1.0/jquery.mobile-1.1.0.min.css /
  script src=https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js/script
  script src=https://ajax.aspnetcdn.com/ajax/jquery.mobile/1.1.0/jquery.mobile-1.1.0.min.js/script
 /head
 body
  div data-role=page id=teste
   div id=btnlogin_outer
    input id=btnlogin class=ui-btn-hidden type=button tabindex=0 value=Logar-se name=btnlogin aria-disabled=false
   /div
  /div
 /body
/html


Além destes temos mais o my.js que é o javascript que conterá o código Javascript para efetuar a ação.

O objetivo é clicar no botão (btnlogin) e o texto TESTE (da lblfun) do html pai ser alterado para Logado através de Javascript (ou jQuery).

Como te informei, já tentei mil coisas e não consegui.
Muito obrigado.
Responder

16/08/2012

Thiago Palmeira

Olá, desculpe a demora

segue o código

<HTML>
<HEAD></HEAD>
<FRAMESET cols="20%, 80%">
  <FRAMESET rows="100, 200">
      <FRAME src="NomeDoFrame1.html">
      <FRAME src="conteudoframe2.gif">
  </FRAMESET>
  <FRAME src="conteudoframe3.html">
  <NOFRAMES>
      <P>Este documento constituído por um conjunto de molduras contém:
      <UL>
         <LI><A href="NomeDoFrame1.html">Conteúdos Frame 1</A>
         <LI><IMG src="conteudoframe2.gif" alt="Imagem">
         <LI><A href="conteudoframe3.html">Conteúdo Frame 3</A>
      </UL>
  </NOFRAMES>
</FRAMESET>
</HTML>
Responder

16/08/2012

Joel Rodrigues

Cara, eu nunca usei, nem sei se pode lhe ser útil, mas o jQuery tem o método load() que permite carregar um conteúdo em uma div (fazer o papel do iframe). Talvez fosse interessante tentar usar.
Responder

Assista grátis a nossa aula inaugural

Assitir aula

Saiba por que programar é uma questão de
sobrevivência e como aprender sem riscos

Assistir agora

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar