0

This can't be as difficult as I am making it, but I am having the worst time getting a simple answer to this question. I can find lots of topics and tutorials for calling upon a frame from another frame using Javascript or selecting iframes. However, calling a child frame from the parent window's javascript appears to be a rarity.

I have a parent webpage with a frame in it pointing to a child page. The child page has form elements in it. I want to use Javascript in the parent window to change form elements in the child window.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<script type="text/javascript">
<!--
// I am having trouble getting THIS line to locate the frame
document.childFrame.document.getElementById('Website').value = 'domain.com';
-->
</script>

<frameset rows="100%">
    <frame name="childFrame" src="child.html" />
</frameset><noframes></noframes>

</html>
Tanoro
  • 871
  • 2
  • 10
  • 30
  • You should check this question, it is similar: [How to call javascript function specified in a child ](http://stackoverflow.com/questions/5946656/how-to-call-javascript-function-specified-in-a-child-frame) – Laurent Apr 18 '12 at 15:29
  • 2
    Also, this will only work if the child frame is on the same domain because of the [same origin policy](https://en.wikipedia.org/wiki/Same_origin_policy). – Laurent Apr 18 '12 at 15:31
  • Thank you. That gave me some direction. – Tanoro Apr 18 '12 at 15:34

0 Answers0