www.webdeveloper.com
Results 1 to 6 of 6

Thread: Help with JavaScript game

  1. #1
    Join Date
    Apr 2011
    Posts
    3

    Question Help with JavaScript game

    I am familiar with cgi and php but I never have learned javascript. I have a copy of a javascript game that says 'you win' when you win. I need it to either give a link or go to a new web page at that point. Adding a basic html link after You win doesn't work so I assume I need a javascript code here. Can anyone help?

    HTML Code:
    if(win(tic_tac_toe, Computer_Letter()))
               {
               document.tic_tac_toe.message.value = 'I win';
               }
    
             if(win(tic_tac_toe, Player_Letter()))
               {
               document.tic_tac_toe.message.value = 'you win';
               }

  2. #2
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,412
    Where do you want it to go, win or lose?

  3. #3
    Join Date
    Apr 2011
    Posts
    3
    Instead of 'you win' I need it to go to (or link to) to the page quizpoints.php?score=100 so that my php script can award their account for playing.

  4. #4
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,412
    document.location.href = 'quizpoints.php?score='+score;

  5. #5
    Join Date
    Apr 2011
    Posts
    3
    Thank you so much!! That worked perfectly.

  6. #6
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,412
    You're most welcome.
    Happy to help.
    Good Luck!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles