Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-28-2012, 01:18 PM   PM User | #1
vikram1vicky
Regular Coder

 
Join Date: Jul 2011
Location: India
Posts: 496
Thanks: 3
Thanked 57 Times in 56 Posts
vikram1vicky is an unknown quantity at this point
Function is not working on page refresh in firefox 14

Hi,

Following function is working fine when we load page 1st time, but not working when we refresh the page in Firefox (but working fine in Chrome)

Code:
function start() {
        getXY();
        rndmX = x, rndmY = y;
        snake.Body.unshift([rndmX,rndmY]);
        resetInterval();            
        direction = snake.dir[Math.round(Math.random()*3)];
        getFood();        
        enable('#restart');
        $('#restart').css({background:'#9B3378'});
        enable('#pause');
        $('#pause').css({background:'#E09926'});
        enable('#stop');
        $('#stop').css({background:'#AD4343'});
        cnvs.focus();
        disable('#start');
        $('#score').html(score);
    }
Following are the functions being called in above functions:

Code:
function getRN(max) {
        var n, mod;
        n = Math.round(Math.random()*max);
        mod = n%grid;
        n = n - mod;
        n = n >max?max:n;
        return n;        
    }
    
    function getXY() {
        x = getRN(maxX);
        y = getRN(maxY);
        return x,y;
    }

function resetInterval() {
        clearInterval(interval);
        interval = 0
        interval = setInterval(moveSnake, snake.speed);
    }
Please help ... Thank you in advance

Last edited by vikram1vicky; 08-28-2012 at 01:19 PM.. Reason: wrong title
vikram1vicky is offline   Reply With Quote
Reply

Bookmarks

Tags
javascript, jquery

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:24 AM.


Advertisement
Log in to turn off these ads.