Below is sample code from W3Schools telling how to start a js routine by pressing a button. Of course you sgould insert your code in place of the java script in the exhample.
Hope this helps,
Al
My Web Page
A Paragraph
trying to put my simple javascript game into my html code for my website. but when I do it automatically runs when when I open my page. I only want it to run when I click on something, like a button. I've read documentation online about onclick, but I cant seem to get it write. what do i do?
if i have a javascript file called (hypothetically) ticTacToe.js
how would I link that to my html document to play when i use onclick?
please help