Javascript调用Javascript

都才俊
2023-12-01

caller.html

<html>
<head>
	<script type="text/javascript">
	function callJs(jsFileName) {
		var js = document.createElement('script');
		js.src = jsFileName;
		try {
			document.getElementsByTagName('head')[0].appendChild(js);
		} catch (exp) {}
		js = null;
	}
	callJs("callee.js");
	</script>
</head>
</html>

callee.js

alert("hello, i am callee.js");


 类似资料: