单击下面显示的按钮时,我需要怎么做才能在两个外部JS文件中执行代码?
<html>
<head>
<title>Vending Machine</title>
</head>
<body>
<script src="script.js"></script>
<script src="script2.js"></script>
<button type="button" onclick="">Press the Button</button>
</body>
</html>
在您的javascript文件中,应该有一个名为myFunction的函数,例如
<button onclick="myFunction()">Try it</button>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句