html : 引用src参数value=2
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="js/a.js?value=2" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
a();
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
js/a.js: 读出传入参数value=2 ,引用b.js
var js = document.getElementsByTagName("script");
for (var i = 0; i < js.length; i++) {
if (js[i].src.indexOf("a.js") >= 0) {
var arraytemp = new Array();
arraytemp = js[i].src.split('?');
arraytemp = arraytemp[1].split('=');
alert(arraytemp[0] + "=" + arraytemp[1]);
}
}
document.write("<script language='javascript' src='js/b.js'></script>");
function a() {
b();
alert('This is aa!');
}
js/b.js:
function b() {
alert('This is bb!');
}