javascript - 用户要求提示时扣币
问题描述
我想创建一个提示,它会提示用户是否需要提示答案。如果用户想要一个提示,它会显示一个提示并从用户那里扣除 100 个硬币。我尝试了很多次,但仍然没有用。
<a href="#hint" class="btn btn-info" id="hint" data-toggle="collapse"
onclick="Confirmation()">Hint</a>
function Confirmation() {
var retVal = confirm("Are you sure you want a hint");
if (retVal == true) {
<div id="hint" class="collapse">
<span style=" border: 1px solid #d6d6d6;">Answer: A </span>
</div>
**//Not sure on how to deduct 100 coins**
return true;
}
else {
document.write("User does not want to continue!");
return false;
}
}
解决方案
您正在调用 Confirmation() 而您的函数名为 getConfirmation()
推荐阅读
- javascript - 检查 onClick 反应的值
- python - 集合操作数 ( | , & , - ,..etc) 是如何工作得这么快的?
- python - 如何从 csv 文件中过滤数据并合并所有过滤后的数据?
- mysql - JOIN BY 公司 Big SQL 查询
- r - How to convert x values from dbeta plot into percentage using base r?
- python - 是否可以在文档字符串中包含常量的值?
- java - 添加 NULLS LAST 时的问题
- c# - 自定义属性的命名约定和准则
- python - 获取异常消息的更好方法是:str(e) vs e.args[0]?
- java - 使用 spring boot 和 hibernate 执行多个不同的查询