日期:2014-05-18  浏览次数:20539 次

请问:在一个.js文件里面用到另外一个.js文件的函数
在一个.js文件里面用到另外一个.js文件的函数
怎么用?

------解决方案--------------------
在页面里引用另一个js文件的相对路径即可。
------解决方案--------------------
晕,你不会写两个 <script啊?
------解决方案--------------------
1楼说的就可以……
------解决方案--------------------
在同1个页面引用了2个JS文件,就可以直接调用了啊,
see:

1.js:

function test1(){
alert( '1 ');
}

2.js:
function test2(){
test1();
alert( '2 ');
}

2.htm

<head>
<script src= "1.js ">

</script>
<script src= "2.js "> </script>
</head>
<body>

<input type= "button " value= "1 " onclick= "test1() " />
<input type= "button " value= "2 " onclick= "test2() " />
</body>