Defer loading of JavaScript

<script type="text/javascript">
	// Add a script element as a child of the body
	function downloadJSAtOnload() {
	var element = document.createElement("script");
		element.src = "deferredfunctions.js";
		document.body.appendChild(element);
	}

	// Check for browser support of event handling capability
	if (window.addEventListener)
		window.addEventListener("load", downloadJSAtOnload, false);
	else if (window.attachEvent)
		window.attachEvent("onload", downloadJSAtOnload);
	else 
		window.onload = downloadJSAtOnload;
</script>

Deferring loading of JavaScript functions that are not called at startup reduces the initial download size, allowing other resources to be downloaded in parallel, and speeding up execution and rendering time.

Reference URL