Reputation: 41
How do I add a file to an image so when the image is clicked it runs the file? I would like when I click on a picture of a battleship it runs that game I wrote. The image is on line 30. There's two files, an html and JavaScript file. I tried looking it up myself but being so new to this I really could use some advice. Thank you!
my page is josephhyatt.com if you can review it.
Upvotes: 1
Views: 46
Reputation: 5997
You can use <img src="" onclick=functionName()/>
as @MCVNOOB said. This calls a certain function whenever the image is clicked on. If you change functionName()
to the function that begins your game, your game will be executed when the image is clicked on.
Upvotes: 1