Click here to Skip to main content
15,665,276 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Good-day can someone help me with a html and javascript for this please which allow its user to signal the start of the timer (after the driver has parked), and the end of the timer (when the driver is leaving). The application will then which compute and display the total hours spent as well as the total monies to be paid. All paid-parking locations operate between 5AM to 5PM (a total of 12 hours) – if a driver’s total hours exceed 12 hours, they pay $2,000.

I'm new to all of this, can anyone be of assistance please

What I have tried:

<title>Paid Parking App

<meta="amis, adit"="">

	<div data-role="page" id="pg1">	
		<div data-role="header" id="header">
			<h1>PAID PARKING APP</h1>

<table><tbody><tr><td>Total monies to pay:
</td></tr><tr><td>Total hours parked:
</td></tr><tr><td>Stop Timer
</td></tr><tr><td>Start Timer
</td></tr><tr><td>Select the paid parking rate:
</td></tr><tr><td><ul style="list-style-type: none">
<li></li><li>$50 <br></li><li></li><li>$100 <br></li><li></li><li>$150 <br></li><li></li><li>$200 <br></li><li></li><li>$250 <br></li><li></li><li>$300</li></ul></td></tr></tbody></table>



function startTimer(){
  timex = setTimeout(function(){
    if(seconds >59){seconds=0;mins++;
       if(mins>59) {
         if(hours <10) {$("#hours").text('0'+hours+':')} else $("#hours").text(hours+':');
       else $("#mins").text(mins+':');
    if(seconds <10) {
      $("#seconds").text('0'+seconds);} else {
Updated 11-Feb-22 5:29am
Richard MacCutchan 11-Feb-22 11:24am    
You are trying to update seconds, mins and hours in your startTimer function. But you have never declared those variables.

While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
Share this answer
Ashantia Clarke 11-Feb-22 11:19am    
i only need help with javascript please, i tried doing the java with a few code but it keeps saying error.
You can replace most of your code with a simple call to JavaScript Date getTime() Method[^]. Do this at the beginning and again at the end. The difference between the two values is the total time.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900