473,383 Members | 1,717 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

How to pause function then retrieve information

BradleyJS
Hi
I have an assignment for school and i was just wondering can someone help me to
complete it correctly. It is a memory game that has a timer included and i have got a play button that when clicked it activates function init(); (this function scrambles up the memory pictures and starts the timer). I want to add a pause button which when clicked will stop the game and the timer and also a continue button that when clicked retrieves the information of the amount of completion of the game and the time that was on the timer when the pause button was clicked.

Bradley
Mar 25 '08 #1
5 1364
acoder
16,027 Expert Mod 8TB
The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.

Please read the Posting Guidelines and particularly the Coursework Posting Guidelines.

Then when you are ready post a new question in this thread.

MODERATOR
Mar 25 '08 #2
I am sorry I did not mean for anyone to do my assignment i just need to know can I pause the game but clicking a button then using a function to retrieve the information when a continue button is clicked
if this is possible can someone please explain how i could be done
Bradley
Mar 26 '08 #3
I have tried this code to pause but now I've used it the play button code doesn't work and how would i code for retrieving the information.

My pause function
function pausefunc(){ // this is my very own function which pauses the games when the button is pressed
pause init();
}

<img src="stop button copy.png" onclick="pausefunc()">

Attempt at retrieve function

function retrievefunc(){
retrieve init();
}

<img src="continue button copy.png" onclick="retrievefunc()">


I don't think my attempt is right because I don't even know if retrieve init(); would do anything

Bradley
Mar 26 '08 #4
I have tried this code to pause but now I've used it the play button code doesn't work and how would i code for retrieving the information.

My pause function

Expand|Select|Wrap|Line Numbers
  1. function pausefunc(){ // this is my very own function which pauses the games when the button is pressed
  2. pause init();
  3. }
  4.  
  5. <img src="stop button copy.png" onclick="pausefunc()">
  6.  
Attempt at retrieve function

Expand|Select|Wrap|Line Numbers
  1. function retrievefunc(){ 
  2. retrieve init();
  3. }
  4.  
  5. <img src="continue button copy.png" onclick="retrievefunc()">
  6.  
I don't think my attempt is right because I don't even know if retrieve init(); would do anything

Bradley
Mar 26 '08 #5
acoder
16,027 Expert Mod 8TB
I want to add a pause button which when clicked will stop the game and the timer and also a continue button that when clicked retrieves the information of the amount of completion of the game and the time that was on the timer when the pause button was clicked.
I assume you're using either setTimeout or setInterval to run the timer. I also assume the timer is displayed on the page. If so, you can just stop the setTimeout/interval with the counterpart clearTimeout/clearInterval respectively. The continue button can use setTimeout/setInterval to start the timer again. To retrieve the information on amount of time left wouldn't be difficult if the timer is displayed on the screen. If it's within a span/div element just access the element using document.getElementById(timerID) and then get its innerHTML property.
Mar 26 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: arajunk | last post by:
I was looking around for some code for a special purpose and found this. Seems it should print "here we go" , pause 5 seconds, print "now we are back". Instead, it pauses 5 seconds before...
8
by: Wim | last post by:
My GUI application starts a process (a console program) when the user hits Play. I would like to add an option to pause that process. The code I've added to detect if the user hit pause/unpause...
2
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. Is there a way to start, pause and resume a recurrsive search exactly where you left off, say in the registry programmatically? -- Michael Bragg,...
7
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I am using this code to get groups for a user and getting a error (5) on the GetAuthorizationGroups() function . There are two domains. This function works on the local domain but does not work...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.