- 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
- Computer Vision for the Web
- Python機器學習:數據分析與評分卡建模(微課版)
- JavaScript Unlocked
- 程序員考試案例梳理、真題透解與強化訓練
- C語言程序設計案例精粹
- Serverless架構
- iOS開發實戰:從入門到上架App Store(第2版) (移動開發叢書)
- Java網絡編程實戰
- 寫給程序員的Python教程
- 網絡數據采集技術:Java網絡爬蟲實戰
- Practical Predictive Analytics
- ASP.NET jQuery Cookbook(Second Edition)
- 樹莓派開發從零開始學:超好玩的智能小硬件制作書
- Python Django Web從入門到項目實戰(視頻版)