After clicking on the scale a tag, a window with OK and Cancel pops up. Click OK to execute an action, otherwise it will not be executed.
First, let's use the ecshop template as an example
{if $votings eq 1} <a href="javascript:;" onclick="if (confirm('m multiple votes will deduct 100 points. Are you sure to vote?')) {vote_this({$item.id},{$item.cat_id});}else{return false;}" id="supportme15" ></a> {else} <a href="javascript:;" onclick="vote_this({$item.id},{$item.cat_id})" id="supportme15" ></a> {/if}<script type="text/javascript">function vote_this(voting_id,cat_id){ $.post("voting_ajax.php", {cat_id:cat_id,voting_id:voting_id}, function(data){ alert(data.message); window.location.reload(); },"json");}</script>Explanation.$votings is used to determine whether to vote multiple times. If you vote again, execute the js function vote_this() and deduct points.
If the background finds that the member is voting for the first time, it will be executed directly without deducting points, and naturally there is no need to remind you.
The above method can be summarized simply as
Confirm popup using JS
Example: Use the confirmation dialog to make a user make a decision
<script> like=window.confirm("Do you think it's good?"); if(like==true) document.write("Thank you for your praise");//Cancel</script>Isn't it very simple? I hope this article can help you