<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>测试 </title> <script type="text/javascript"> function myclick(){ var oldS=document.getElementById('thejs'); if(oldS) oldS.parentNode.removeChild(oldS); var t=document.createElement('script'); t.src='a.js'; t.type='text/javascript'; t.id="thejs"; document.getElementsByTagName('head')[0].appendChild(t); //document.getElementById("thejs").src="a.js"; } </script> <script type="text/javascript" id="thejs"> </script> </head> <body> <input type="submit" value="查询" onClick="javascript:myclick();" /> </body>