javascript - 2 Bugs: Possible Cross-Browser Issues -


i'm making javascript game , experiencing 2 problems i'll try describe in sufficient detail. (the web page on problems occurring jaminweb.com/snake.html).

the first 1 of listeners not seem working.

i have, in between script tags in head,

$("#buttonname").click(function() {   alert("good ... function called.");   s = new game(param1, param2, param3); }); 

and

<button id="buttonname">start game</button> 

in body, yet anonymous function not getting called. it's not passing 'ole alert test see i've set up. there no errors being logged console when load page.

the second problem that, while game works on computer here @ work on google chrome, doesn't work on firefox , doesn't work on browsers when use machine @ home. game not detecting when snake comes in contact food. think problem lies in these lines:

var height = math.floor($("#somediv").height())+1;  var width =  math.floor($("#somediv").width())+1; 

for reason, think variables getting calculated differently on browsers. problem, , how resolve it?

dunno if helps or not, if have button hyperlink going somewhere, address wont work because url uses computer/user name in , file name it's saved in did this...

<button id="buttonname"> start </button> 

and then

    $("#buttonname").click(function() {   <!-- going page here computer not able find page because of user in link: file:///c:/users/username/desktop/xxx%20stuff/corn%20puff%20cereal.html   s = new game(param1, param2, param3); }); 

another thing "s" variable , had declared earlier?


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -