Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion templates/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
}

</script>

{% endblock %}


Expand Down Expand Up @@ -130,8 +131,21 @@ <h2 class="card-title">{{ article.title }}</h2><!--title-->
<textarea class="form-control" rows="3" name="body" placeholder="write something here..." required="required"></textarea>
</div>

<button class="btn btn-primary" type="submit" style="float:right">comment</button>
<button id="btn" class="btn btn-primary" type="submit" style="float:right" onClick="prevent()">comment</button>
Copy link
Copy Markdown
Member Author

@spm2020spring spm2020spring Jan 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@1500h

Why do you have the prevent() method, which is not defined anywhere?

Could you remove onClick="prevent() if it is no longer needed?

-Hui

</form>
<script type="text/javascript">
// 第一种 通过点击事件
var clicktag = 1;
btn.onclick = function () {
if (clicktag == 3) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@1500h

Why do you choose 3, instead of 4 or 5?

-Hui

alert("请勿频繁点击!");
setTimeout(function () { clicktag = 0 }, 5000);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@1500h

Probably you want to use a bigger number than 5000, as a more serious warning.

-Hui

} else {
clicktag = clicktag + 1;
}
}

</script>
</div>
</div><br>

Expand Down