简体   繁体   中英

javascript's event handler in separate html file and javascript file

I want to write javascript's event handler in separate html file and javascript file. I am in trouble because it does not work if it is the method of reference site. Sample Site : https://techacademy.jp/magazine/15062

How do I write event handlers in javascript without writing event handlers in html? I would like to write it in a way like a sample site.

write code in a separate js file and add on the HTML using <script> file just before </body>

<script type="file/path/name.js"></script>

is that you are asking about?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM