In IE, I can change the src for a script after the page has loaded:
However, this doesn't seem work with Mozilla or Opera. Anybody know of a way to do this in those browsers, or is this sort of thing unsupported?
Code:
<html>
<head>
<title>DHTML Script Test</title>
<script language="javascript" type="text/javascript">
<!--
var elScript = null;
function loadScript() {
elScript = document.getElementById("oScript");
elScript.src = "script.js";
test(); //call a function in script.js
}
//-->
</script>
</head>
<body>
<script id="oScript" src="" language="javascript" type="text/javascript"></script>
<input type="button" value="Script" onClick="loadScript()" / >
</body>
</html>
However, this doesn't seem work with Mozilla or Opera. Anybody know of a way to do this in those browsers, or is this sort of thing unsupported?