Released: 12/27/2004
DOWNLOAD CODE FOR THIS ANSWER
Question:
Someone help me out.
I have 3 Iframes I only want to play with 2.

1) One has links for others to click on :

//Iframe 1
<a href="javascript:click(email@email.com)">email@email.com</a>

2) The other Iframe will receive the value on hidden form and non-hidden form:

//Iframe 2 name="envia" id="envia"
<form method="post" name="frm2" action="">
<input type="text" name="email" value="">
</form>

Could someone make a working function please.


Here´s what I got on Iframe 1

<script language="javascript">
function click(email){
window.frames['envia'].frm2.email.value = 'iframe_page1.html';
alert('ok');
}
</script>
Answer:
If I am reading this correctly you are asking about passing a variable between two frames?
well if that is the case then here it is:

iframeContainer.htm - contains both frames
Code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<P><IFRAME name="Action" src="ActionPage.htm">
</IFRAME></P>
<P><IFRAME name="Target" src="TargetPage.htm">
</IFRAME></P>
</body>
</html>

ActionPage.htm - contains action to send email

Code:
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
<TITLE>ActionPage</TITLE>
<SCRIPT>
function passEmail(em)
{
top.frames['Target'].document.frm2.email.value = em;
alert(em)
}
</SCRIPT>
</HEAD>
<BODY>
<a href="javascript:passEmail('email@email.com')">email@email.com</a>
</BODY>
</HTML>
TargetPage.htm - cintains form to receive email
Code:
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
<TITLE></TITLE>
</HEAD>
<BODY>
<form method="post" name="frm2" action="">
<input type="text" name="email" value="">
email shows here</form>
</BODY>
</HTML>
here is a demo 
Top of Page

Valid HTML 4.01!

Views: 2010

Valid CSS!