- Mastering JavaScript Functional Programming
- Federico Kereki
- 139字
- 2021-07-02 22:41:09
Solution #1 - hope for the best!
How can we solve the problem? The first solution may seem like a joke: do nothing, tell the user not to click twice, and hope for the best! Your page might look as Figure 2.1.

Figure 2.1. An actual screenshot of a page, just warning you against clicking more than once
This is a weasel way of avoiding the problem, but I've seen several websites that just warn the user about the risks of clicking more than once (see Figure 2.1) and actually do nothing to prevent the situation... the user got billed twice? we warned them... it's their fault! Your solution might simply look as the following code.
<button id="billButton" onclick="billTheUser(some, sales, data)">Bill me</button>
<b>WARNING: PRESS ONLY ONCE, DO NOT PRESS AGAIN!!</b>
OK, so this isn't actually a solution; let's move on to more serious proposals...
推薦閱讀
- Mastering Entity Framework Core 2.0
- 兩周自制腳本語言
- 深入淺出Java虛擬機:JVM原理與實戰
- HoloLens Beginner's Guide
- Apache Spark Graph Processing
- Scratch真好玩:教小孩學編程
- Nginx Essentials
- Unity 2018 Shaders and Effects Cookbook
- IBM Cognos Business Intelligence 10.1 Dashboarding cookbook
- Spring Boot實戰
- Android傳感器開發與智能設備案例實戰
- Hands-On Nuxt.js Web Development
- 計算機系統解密:從理解計算機到編寫高效代碼
- Java面向對象程序設計教程
- 軟件開發中的決策:權衡與取舍