Javascript 如何在html中使用变量作为参数

Javascript 如何在html中使用变量作为参数,javascript,html,spring,thymeleaf,Javascript,Html,Spring,Thymeleaf,我在HTML中使用了Thymeleaf <h1 class="timer count-title count-number" data-to="${atendida}" data-speed="1000"></h1> 在这种情况下如何使用atendida?欢迎使用SO 如果希望只打印对象的值,可以执行以下操作: <h1 class="timer count-title count-number" th:text="${atendida}" data-speed="

我在HTML中使用了Thymeleaf

<h1 class="timer count-title count-number" data-to="${atendida}"
data-speed="1000"></h1>
在这种情况下如何使用atendida?

欢迎使用SO

如果希望只打印对象的值,可以执行以下操作:

<h1 class="timer count-title count-number" th:text="${atendida}"
data-speed="1000">Some Timer</h1>
<h1 class="timer count-title count-number" th:attr="data-to=${atendida},data-speed=${someSpeed}">Timer</h1>
如果有自定义属性值,则可以执行以下操作:

<h1 class="timer count-title count-number" th:attr="data-to=${atendida}"
data-speed="1000">Timer</h1>
如果希望同时执行这两个属性,可以执行以下操作:

<h1 class="timer count-title count-number" th:text="${atendida}"
data-speed="1000">Some Timer</h1>
<h1 class="timer count-title count-number" th:attr="data-to=${atendida},data-speed=${someSpeed}">Timer</h1>
你可以在