The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Calculation, To calculate fields with every input
bmbot
post Oct 15 2017, 04:08 AM
Post #1





Group: Members
Posts: 1
Joined: 15-October 17
Member No.: 26,514



I am trying to build a calculator for a board game. At the start of the game, an input is sought for the number of players (say 2) and the amount of game currency given to each player (say 1000). Once this input is stored, another screen appears as follows:

Player 1: 1000 Add: Less:

Player 2: 1000 Add: Less:

Bank : 0

In the above, "Player 1" and "Player 2" are labels. "Add" and "Less" are buttons with the space in front of them have input fields. So if Player 1 makes a purchase of 200, in front of the "Less" button against Player 1, 200 is entered and the "Less" button is pressed. On that action, the Bank increases by 200 and Player 1 balance reduces from 1000 to 800. Similar actions lead to similar result. The game ends when the Bank becomes 0 after at least [number of players] * 3 clicks of add or less.

I want to build this as a HTML code that I can embed on a third party application.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Oct 15 2017, 04:24 AM
Post #2


.
********

Group: WDG Moderators
Posts: 7,728
Joined: 10-August 06
Member No.: 7



This can't be done with HTML alone, you need a scripting language. Javascript is simple, and works well if the game is only meant to be seen in the user's own browser, and doesn't need to be saved. In other cases you need a server side language (e.g. PHP), and if you want different people to play with each other online (in separate browsers) you probably also need a database. Finally, if you'd want the server to update the users' games in real time, you might need Ajax and/or Push technology.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 18th November 2017 - 10:39 AM