Search code examples
javascriptjqueryhtmliframeframeset

How to access via javascript that exists in page1.aspx, a hidden field that exists in page2.aspx in a frameset of two frames


Is there a way to access via javascript that exists in page1.aspx, a hidden field that exists in page2.aspx?

   <frameset rows="*, 70px" border="0">
                        <frame noresize  tabindex="105" frameborder="0" name="central"   src="http://10.11.21.191/domain/page2.aspx">
                        <frame noresize  tabindex="106" frameborder="0" name="telephony" src="http://10.11.21.191/domain/page1.aspx">
            </frameset>

Solution

  • You may use

    parent.telephony.varname
    

    to access from central the var varname defined in telephony.

    For a form field, simply use

    parent.telephony.forms[0].fieldname.value
    

    This works only because both documents are from the same domain and might not work if you open the file in file:// instead of http://.