js动态加载js

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
>
<link rel="stylesheet" id='cssSha' href="fengru_share.css"
	type="text/css" />
<link rel="stylesheet" id='cssGbl' href="fengru_global.css"
	type="text/css" />
<link rel="stylesheet" id='cssGbl' href="common.css" type="text/css" />
<style>
.x-tree,.x-panel-body {
	border: 0px;
	margin: 0px;
	float: left;
	width: auto;
	height: auto;
}
</style>

<script type="text/javascript" charset="utf-8">
	var fso = new ActiveXObject("Scripting.FileSystemObject");
	function searchFiles(path) {
		var f = fso.GetFolder(path);
		var fc = new Enumerator(f.files);
		for (; !fc.atEnd(); fc.moveNext()) {
			var v = fc.item();
			var jsfile = document.createElement("script");
			jsfile.src = v;
			jsfile.type = 'text/javascript';
			document.getElementsByTagName("head")[0].appendChild(jsfile);
			alert(v);
		}
		var fk = new Enumerator(f.SubFolders);
		for (; !fk.atEnd(); fk.moveNext()) {
			var v = fk.item();
			var f = fso.GetFolder(v);
			var fc = new Enumerator(f.files);
			if (!fc.atEnd()) {
				searchFiles(v);
			}
		}
	}
</script>
</head>
<body bgcolor="#FFFFFF"
	onload="searchFiles('D:\\Program Files\\tomcat\\webapps\\qff\\js')">

	<input type="button" value="fileDIr"
		onClick="searchFiles('D:\\Program Files\\tomcat\\webapps\\qff\\js',0,'')">
	<table>
		<tr>
			<td id="textarea"></td>
		</tr>
	</table>
</body>
</html>



   

你可能感兴趣的:(js动态加载js)