js文件怎么包含另一个js文件?
js.html文件
<!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=gb2312" />
<title>无标题文档</title>
<script type="text/javascript" src="01.js" ></script>
</HEAD>
<BODY>
<form action="" method="post">
<p>
<input name="name" id="name" type="text" />
<input name="" value="测试" type="button" onClick="aa()">
<script type="text/javascript" src="02.js"></script>
</p>
</form>
</BODY>
</HTML>
01.js
function aa(){
document.write('<scri'+'pt type="text/javascri'+'pt" src="02.js"></scri'+'pt>');
alert('测试成功');
}
02.js
document.getElementById('name').value = '张三' ;
在点击测试按钮时,页面内容就不显示了,好像提交了表单,
怎么才能在点击了测试按钮后,输入框显示“张三”,然后弹出 测试成功 ?
各位有没有好的解决办法,谢谢!