Edit: I forgot to mention that I am doing it on pythonanywhere, and check for errors on the console of the inspect tool
I have a button formatted like the one below, but when ever I try and click it, it says that the function is undefined; even though I have it imported correctly.
The button is formatted like this:
<button type="button" id="ManualGain" class="buttons" onclick="IncreaseBal()">Press me for money</button>
The import is formatted like this:
<script type="text/html" src="GameCode.js"></script>
And here is the IncreaseBal function in GameCode.js:
function IncreaseBal() {
GameVars.balance += 10
document.getElementById("Balance").innerText = "Balance: " + GameVars.balance
}
The GameVar function is pretty much formatted as:
var GameVars = {
balance = 0,
...
}
However, I haven't been able to get it to work.