Home|Sitemap|Contact

How can you use JavaScript to include another file on your page?

Use the remote scripting object.  See this article.

[Click to change]


[Click to change]


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>JavaScript Include Example</title>
<script type="text/javascript" src="/include/include_v2.js"></script>
<style type="text/css">
<!--
img {
    border:0;
}
-->
</style>
</head>

<body>
<noscript>This page requires JavaScript to be supported or enabled for complete functionality.</noscript>
[<a href="#" onclick="include('emails.txt','theExample','images/loading_icon.gif');">Click to change</a>]<br>
<div id="theExample"><iframe name="altFrame" src="latin.htm" scrolling="no" frameborder="0">Your browser does not support inline frames or is currently configured not to display inline frames.</iframe></div>
[<a href="#" onclick="include('movies.txt','theExample1','images/loading_icon.gif');">Click to change</a>]<br>
<div id="theExample1"><iframe name="altFrame" src="latin.htm" scrolling="no" frameborder="0">Your browser does not support inline frames or is currently configured not to display inline frames.</iframe></div>
<script type="text/javascript">
//<![CDATA[
include('latin.htm','theExample','images/loading_icon.gif');
include('lincoln.htm','theExample1','images/loading_icon.gif');
//]]>
</script>
</body>

</html>