【发布时间】:2019-05-18 04:41:26
【问题描述】:
嘿,我想实现一个计时器,如果我转到这个模板就会启动:
{% block content %}
<h3>C-Test</h3>
<p>In the following text, some of the word endings have been replaced by a gap. The gap is approximately half of the word, e.g. if you see 3 letters, you need to add another 3-4 letters to complete the word. Try your best.</p>
<form action="results" id=results method="POST">
<input type="hidden" name="cTestFormat" value="{{ text }}">
<div class="ctest">
{% csrf_token %}
{{ forms }}{{ ende }}
</div>
<div class="command">
<button type="submit" name="ctest_submit">Submit solution</button>
</div>
</form>
{% endblock %}
并在我单击提交解决方案按钮时结束。
我希望将其保存到POST 请求中,以便我可以在results.html 中返回时间。
这是我的results.html:
{% block content %}
<h3>C-Test</h3>
{% csrf_token %}
<p>You got {{ richtige }} right!!!!!!</p>
<p>But {{ falsche }} wrong :(</p>
<p> {{ testresult|safe }}</p>
{% endblock %}
我读到您需要一些脚本语言来编写计时器,但我对此没有任何经验。 django 有没有其他方法可以做到这一点,还是我需要类似 javascript 的东西?
【问题讨论】:
标签: javascript html django timer django-templates