我正在生成一个包含很多产品的页面,为此,我需要很多 ID,并且我使用服务器端(Python)完成了它,所以我为每个产品发送了它自己的<div id='hello1'> test </div>
现在因为用户将 dinamycaly 设置一个值并在浏览器中查看结果,所以我想生成另一个ID
,我已经找到了btoa("hello1")
,所以我生成了另一个ID
btoa("hello1")
那么问题来了,我该如何输入<div>
?
编辑:我要生成的是另一个<div>
,而不是更新第一个。
<input id="{{str(product["avt"]["fto"])}}" > this will become <input id="12232" > because it is special to Tornado Template
<span>New price :</span>
<span id=btoa({{str(produit["avt"]["fto"])}})> This is where i use innerHTML </span>
如您所见,用户将输入一个值并动态查看它。
这将在 Python 中使用:
<span id="{{base64.b64encode(str(produit["avt"]["fto"]))}}"></span>
但我如果可以使用 Javascript 完成,服务器将免费进行一半的操作!