error: window.parent.sayhello is not a function?
<p>I got a js function that is defined in a JScript.js file. This file is defined on the masterpage. I am trying to call the sayhello function in this file from the inIframe.aspx page. This inIframe.aspx 'runs' inside the webform1.aspx page and the webform1.aspx page has a masterpage called masterWithJs.master.</p>

<p>when I hit :</p>

<pre><code>http://localhost:8022/inIframe.aspx
</code></pre>

<p>I get an script error in firebug:</p>

<pre><code>window.parent.sayhello is not a function
</code></pre>

<p>masterpage:</p>

<pre><code>&lt;%@ Master Language="C#" AutoEventWireup="true" CodeBehind="masterWithJs.master.cs"
    Inherits="IFrameJS.masterWithJs" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head runat="server"&gt;
    &lt;title&gt;&lt;/title&gt;
    &lt;asp:ContentPlaceHolder ID="head" runat="server"&gt;
        &lt;script src="Scripts/JScript1.js" type="text/javascript"&gt;&lt;/script&gt;
    &lt;/asp:ContentPlaceHolder&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;form id="form1" runat="server"&gt;
    &lt;div&gt;
        &lt;asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"&gt;
        &lt;/asp:ContentPlaceHolder&gt;
    &lt;/div&gt;
    &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>webform1.aspx</p>

<pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/masterWithJs.Master" AutoEventWireup="true"
    CodeBehind="WebForm1.aspx.cs" Inherits="IFrameJS.WebForm1" %&gt;

&lt;asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"&gt;
&lt;/asp:Content&gt;
&lt;asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"&gt;
    &lt;iframe id="myIframe" runat="server"&gt;&lt;/iframe&gt;
&lt;/asp:Content&gt;
</code></pre>

<p>inIframe.aspx</p>

<pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="inIframe.aspx.cs" Inherits="IFrameJS.inIframe" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head runat="server"&gt;
    &lt;title&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;form id="form1" runat="server"&gt;
    &lt;div&gt;
        this is the iframe page
    &lt;/div&gt;
    &lt;/form&gt;
    &lt;script type="text/javascript"&gt;
        window.parent.sayhello();
    &lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>JScript1.js</p>

<pre><code>function sayhello() {
    alert( 'hello');
}
</code></pre>

<p>webform1.aspx behindcode:</p>

<pre><code> public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            myIframe.Attributes.Add("src","inIframe.aspx");
        }
    }
</code></pre>
