0

I have a simple (server generated) frame which I would like to retrieve data from to place within a javascript function. How do I do this?

parent.html:

<frameset border=1 rows="*,50">
  <frame src="strip.html">
  <frame src="data.html" name="var_1" >
</frameset>

strip.html:

<html><head>
   <script type="text/javascript">
     function getNumber(){

     var number = parent.var_1.body;

     document.getElementById("Number").innerHTML = number;
     }
   </script>
</head>
  <body onload = "getNumber();">
    <h1>
      Number parsed = <a id="Number"></a>
    </h1>
  </body>
</html>

data.html:

<body>8192</body>

jimzat
  • 45
  • 5

1 Answers1

0

To pull data from an iframe to the parent document use this

To pull data from the parent document to an iframe use this

Please remember that this is type of activity is heavily associated with cross site scripting, so all files will need to be on the same domain, and the only way you will be able to accomplish it locally is if you are hosting the files on a local server.

Community
  • 1
  • 1
Jacob Petersen
  • 1,422
  • 7
  • 16