NameSilo

Javascript problem...

Spaceship Spaceship
Watch

Barrucadu

Established Member
Impact
64
Code:
<script>
var met = <?php echo mysql_result($result,0,'StartMet'); ?>;
var crys = <?php echo mysql_result($result,0,'StartCrys'); ?>;
var deut = <?php echo mysql_result($result,0,'StartDeut'); ?>;

var sc = 0;

function BuySC()
{
	if(met >= 2000){
		if(crys >= 2000){
			if(deut >= 0){
				met -= 2000;
				crys -= 2000;
				deut -= 0;
				sc += 1;
				document.form1.sc.value += 1;
			}
		}
	}
}
</script>

Small Cargos: <script> document.write(sc + "(at 2000 Metal 2000 Crystal 0 Deuterium)"); </script>, <input type = "submit" onClick = "BuySC()" value = "Buy 1">

When I click "Buy 1" nothing happens, well, I dont know if anything happens, it dosnt update the screen.

edit: removed some un-needed code
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Use <input type="button"> instead of submit.

Dunno about anything else..
 
0
•••
Nope, thats not done it

-----

Anyone else going to help?

I checked and it is updating the variables, just not the screen.
Any idea why that may be?

-----

Right, I tried to use a while loop to update it, while you could afford it, it updated every 1 sec.

That went a bit wrong and it printed it on the screen every 1 sec, anyway of making it just update?
 
Last edited:
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back