0
why wont this code work
<html> <head> <title>Snow Clicker</title> <h3><button onclick="hackclick(1)">shovel</button> snow: <span id="money">0</sapn> </3> </head> <body> <script var <money = 0; function snowClick(number){ Money = Monwy + number; document.getElementById("money").innerHTML = money; }; </script> </body> </html>
6 odpowiedzi
+ 19
<h3><button onclick="snowClick(1)">shovel</button> snow: <span id="money">0</sapn>
</h3>
</head>
<body>
<script>
var money = 0;
function snowClick(number){
money = money + number;
document.getElementById("money").innerHTML = money;
};
</script>
<!-- Now it works -->
+ 19
Well, let me start :
- You made an onclick function named "hackClick()" but it should be snowClick() or vice versa. Both of the function names should be same in the HTML as well as in JavaScript. Both should have snowClick() or hackClick()...
- You made a typo closing the <h3> tag! You wrote </3> instead of </h3>...
- You're declaring a variable named "<money" which is wrong. It should not contain "<"...it should be money or something else as per your choice!
- When you wrote the variable name "monwy" inside the function it pop-up an error as monwy is neither a variable nor a constant. In simple words, you have to write "money" instead of "mowny"...
That's all. Hope you understood :D
+ 18
<!-- I'm gonna die! xD -->
<html>
<head>
<title>Snow Clicker</title>
<h3><button onclick="snowClick(1)">shovel</button> snow: <span id="money">0</sapn></h3>
<h3>Snow Earnings</h3>
<p>Bettershovel: <span id="bettershovel">0</span>
</head>
<body>
"<button onclick="buybettershovel()">buy bettershovel</button> Cost: <span id="bettershovelcost">15</span>
<script>
var money = 0;
function snowClick(number){
money = money + number;
document.getElementById("money").innerHTML = money;
};
var bettershovel =0;
function buybettershovel(){
var bettershovel = Math.floor(10 * Math.pow(3.2,bettershovel));
if (money >= bettershovel){
bettershovel = bettershovel + 0.1;
money = money - bettershovelcost;
document.getElementById('bettershovel').innerHTML = bettershovel;
document.getElementById('money').innerHTML = money;
};
var nextcost = Math.floor(10*Math.pow(3.2.bettershovel));
document.getElementById('bettershovelcost').innerHTML = nextcost;
};
</script>
</body>
</html>
0
how what did I do worng?
0
ok thank you
0
ugh now what did I do
<html>
<head>
<title>Snow Clicker</title>
<h3><button onclick="snowClick(1)">shovel</button> snow: <span id="money">0</sapn></h3>
<h3>Snow Earnings</h3
<p>Bettershovel: <span id="bettershovel">0</span>
</head>
<body>
"<button onclick="buybettershovel()"buy bettershovel</button> Cost: <span id="bettershovelcost>15</span>
<script>
var money = 0;
function snowClick(number){
money = money + number;
document.getElementById("money").innerHTML = money;
};
var bettershovel =0;
function buybettershovel(){
var bettershovel = Math.floor(10 * Math.pow(3.2,bettershovel));
if (money >= bettershovecost){
bettershovel = bettershovel + 0.1;
money = money - bettershovelcost;
document.getElementById('bettershovel').innerHTML = bettershovel;
document.getElementById('money').innerHTML = money;
};
var nextcost = Math.floor(10 * math.pow(3.2.,bettershovel));
document.getElementById('nextcost').innerHTML = nextcost;
};
</script>
</body>
</html>