Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q958 How can I export and import functions, objects and properties?

You are here: irt.org | FAQ | JavaScript | Misc | Q958 [ previous next ]

The following will export and import all of the functions, objects and properties from one frame to another. Note, that it requires the explicit JavaScript1.2 language to work, and it is only supported in Netscape Navigator, and then it does not work on the Unix platform.

<frameset cols="50%,*">
<frame src="test.htm">
<frame src="test2.htm">
</frameset>

In test.htm:

<script language="JavaScript1.2"><!--
function test() {
    alert('Hello World');
}

export *;
//--></script>

In test2.htm:

<script language="JavaScript1.2"><!--
import parent.frames[0].*;
//--></script>

<form>
<input type="button" onClick="test()" value="Test">
</form>

©2018 Martin Webb