She*_*009 0 html javascript django templates button
很快的问题.我的模板中有一个像这样的href链接.
<a href={% url tiptop.views.client_items name.pk %}>add item</a>
Run Code Online (Sandbox Code Playgroud)
这有效但是如果我想将它创建为按钮由于某种原因它不起作用.
<input type="button" on_click="window.location.href='{% url tiptop.views.client_items name.pk %}></a>'" value="Add item">
Run Code Online (Sandbox Code Playgroud)
我不明白为什么它不起作用.基本上,按钮显示,但当我点击按钮时,它没有任何作用.
尝试:
<a <!--...your link code here -->
<input type="button" onClick="window.location.href='{% url tiptop.views.client_items name.pk %}'" value="Add item"/></a>
Run Code Online (Sandbox Code Playgroud)
您的行情是单一和双重未正确关闭的行情.