function - simple javascript: "Reference Error: 'click' is undefined" -
so i'm making satirical cookie-clicker based game first ever js game.
i made jsfiddle. (the image won't show, image supposed swag hat, click swag points.) code simple far, wondering why told me click() function undefined. it's mentioned in head , don't know what's wrong.
html:
<html> <head> <title>swag dealr</title> <script src="swagdealr.js"></script> <link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico" /> </head> <body> <h3>swag dealr</h3> <a href="javascript:click()"><img src="img/swaghat.png"></a> <p>grams of swag</p> <p id="swagnumber"></p> <p id=></p> </body> </html>
js:
game={}; game.launch = function() { } window.onload = function() { game.load(); }; game.load = function() { var swagamount = 0; function click() { swagamount + (1 * swagmultiplier) = swagamount; document.getelementbyid("swagnumber").innerhtml = swagamount; } }
update js mentioned below :
game={}; game.launch = function() { } window.onload = function() { game.load(); }; game.load = function() { } var swagamount = 0; function click() { swagamount = swagamount + (1 * swagmultiplier); document.getelementbyid("swagnumber").innerhtml = swagamount; }
note: 1 thing have noticed swagmultiplier not defined anywhere.
Comments
Post a Comment