Jump to content

Basic Problem - Newbie (Increments)


Hoozio

Recommended Posts

Hi guys! Very new here, thought a perfect place to start would be to slowly make a bad incremental game and get the basics down, having trouble at the first hurdle though!

 

The point I'm at is simply having a button synchronize with a table entry which goes up by 1 per button click.

<!DOCTYPE html><html lang="en-US"><title>Incremental</title><head><link rel="stylesheet" href="interface.css"></head><body style="background-color:lightgrey"><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script><script type="text/javascript" src="main.js"></script><div id="header"><h1 style="font-size:300%"><h1 style="text-align:center">My Test Incremental</h1></h1>			<!-- Double header style --></div><br /><br /><br /><table id="t01">	<caption>Resources</caption>	<tr>		<td>Wood</td>		<td><span id="wood">0</span></td>	</tr>	<tr>		<td>Copper</td>		<td>0</td>	</tr>	<tr>		<td>Silver</td>		<td>0</td>	</tr></table><br /><br /><button onclick="woodgain(1)">Chop Wood</button><br /><br /><br /><br /><br /><div id="footer">Test Footer</div></body></html>

Is the HTML, very basic I know!

 

The main.js file as follows:

var wood = 0;function woodgain(number){	wood = wood + number;	document.getElementById("wood").innterHTML = wood;};

I, as you probably guessed, get nothing when I press the button!

 

I'm probably doing a lot wrong, but I learn by my mistakes :)

 

Thanks for any help you can provide

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...