当前位置: 代码迷 >> ASP.NET >> 请教:在一个.js文件里面用到另外一个.js文件的函数
  详细解决方案

请教:在一个.js文件里面用到另外一个.js文件的函数

热度:3071   发布时间:2013-02-25 00:00:00.0
请问:在一个.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>
  相关解决方案