PDA

View Full Version : parent and Iframe Issue! both R on the same domain??


benny
1-4-09, 05:47 AM
From what I Know Both files must reside on the same domain "DONE!'.
Parent --- textbox1.value= ""
Iframe --- textbox1.value= ""
When IFrame loads a my button "called Contents " appears ... I click it calls calls Function thecontents() <!--

this is the iframe function-->
<button........ Contents </button> //calls Function thecontents()//



headerList =document.body.innerHTML
textbox1.value = "<pre>" + headerList + "</pre>";


Now Iframe textbox1.value= 'NEW DATA in here from contents Iframes innerhtml'

is filled with the data I need...... //I have the data I need//
// now lets send the data from the Iframe's text1.value to the parent textbox1//


//"Error at this point"//

X =document.getElementById('textbox1').value ['myIframe'].document.getElementById('textbox1').value


alert(x) //"Error at this point"//

x= Iframes Textbox1.value




parents textbox1.value x ; // should show X but it does'nt//


My Files test1.htm and test2.htm are on my local computer for testing
I did test in my local webserver worked ok until I try to send the data to
the parent...

test1.htm the parent
test2.htm the Iframe inside parent

BrandonMiller
1-8-09, 01:23 AM
I have no idea what your text box thing is but iframes can be different servers..

here is the code for a page I have that uses an iframe

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Erin Miller Photography</title>

<link rel="stylesheet" type="text/css" href="main.css" />


</head>

<body>

<div id="allcontent">

<div id="header"><a href="index.html"><img src="images/photography.jpg" alt="home link" /></a></div>
<!-- End of upper header div -->

<div id="main">


<iframe src="main.html" height="515" width="800" align="middle" class="iframe" frameborder="0"></iframe>

</div> <!-- End of main div -->




<div id="footer">
<a href="mailto:email@erinmiller.net"><img src="images/email.jpg" alt="email link" /></a></div>
<!-- End of upper footer div -->


</div> <!-- End of Wrapper -->
</body>
</html>

in this example it is all local but there is a link from my menu that brings in something from another site, maybe this isn't what your asking..