我用django创作了很多tinymce:
<script type="text/javascript" src="{{ STATIC_PREFIX }}js/tiny_mce/tiny_mce.js"
</script>
<script type="text/javascript" src="{{ STATIC_PREFIX }}js/tiny_mce/tiny_init.js"
</script>
<script type="text/javascript">
tinyMCE.settings = configArray[1];
tinyMCE.execCommand('mceAddControl', true, "tobs");
</script>
{% for obs in obss %}
<div id="obs">
DateTime:<samp>{{ obs.date }}</samp><br>
Description: <br>
<textarea id="tobs" class="ro">{{ obs.description }}</textarea><br>
{% for f in obs.content %}
File:
<a href=Observations/{{f}} title="download file">
<script>
get_name("{{f}}")
</script>
</a><br>
{% endfor %}
Author:<samp>{{ obs.user }}</samp><br>
Type:<samp>{{ obs.category }}</samp><br><br>
</div>
{% empty %}
<br>Sorry, no observations in DataBase.
{% endfor %}
但问题是只有第一个文本区域从configArray[1]获取我的设置,看起来像tinymce,第二个和第三个只是简单的文本区域,没有tinymce设置。在
我怎么换威士忌?在
更改每个文本区域的id。id在HTML中应该是唯一的,但是for循环创建了多个具有相同id的textarea。TinyMCE正试图用^{id1}呈现textarea$
这将使您的文本区域具有id:tobs1、tobs2、tobs3,…,这应该可以解决问题。在
阅读更多信息:https://docs.djangoproject.com/en/dev/ref/templates/builtins/#for
这里:TinyMCE not working when loading two textareas
但是应该有一个更优雅的解决方案来解决这个问题。到目前为止,我已经找到了这个例子,它使用类来区分文本区域,根本不使用id,这与最后一个链接的解决方案相矛盾:http://www.tinymce.com/tryit/3_x/multiple_configs.php
相关问题 更多 >
编程相关推荐