我想创建一个提示,提示用户是否需要提示答案。如果用户想要一个提示,它会显示一个提示并从用户那里扣除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;
}
}
当函数名为getConfirmation((时,您正在调用Confirmation
onclick="Confirmation()"
function getConfirmation()
Confirmation
和getConfirmation
是两种不同的标签