Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

Javascript problem...

Namecheap AuctionsNamecheap Auctions
NamecheapNamecheap
SpaceshipSpaceship
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
Close
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
Close
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
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back