how can I make one button do multiple things for JS?

nomad_00

Prominent
Oct 29, 2017
32
0
540
i am trying to make a project, a small one and want to know how to make a button do multiple things is a sequence, for example first click: how are you? second click: good I am doing quite fine. and contentious more examples, if any one has info they would like to share I would like that.
 
Solution
basic pseudocode:

-------------------------------
Set ClickState = 0
Do Until ClickState = 10

Case ClickState = 0
msg = "how are you?"
Set ClickState = 1
Case ClickState = 1
msg = "What would you like for breakfast?"
Set ClickState = 2
Case ClickState = 2
msg = "No, you cannot have pizza for breakfast"
Set ClickState = 3
Case ClickState = 3
msg = "Go to school!"
Set ClickState = 4
......
......
msg = "What would you like for dinner?"
Set ClickState = 10
Do Loop
End
---------------------------

There are probably 10 different ways to do that.
I'll leave it to you to translate into javascript.


that is not what I meant I would like to create something like that but for javascript
 
basic pseudocode:

-------------------------------
Set ClickState = 0
Do Until ClickState = 10

Case ClickState = 0
msg = "how are you?"
Set ClickState = 1
Case ClickState = 1
msg = "What would you like for breakfast?"
Set ClickState = 2
Case ClickState = 2
msg = "No, you cannot have pizza for breakfast"
Set ClickState = 3
Case ClickState = 3
msg = "Go to school!"
Set ClickState = 4
......
......
msg = "What would you like for dinner?"
Set ClickState = 10
Do Loop
End
---------------------------

There are probably 10 different ways to do that.
I'll leave it to you to translate into javascript.
 
Solution



thanks... i think