【发布时间】:2013-11-20 13:10:50
【问题描述】:
我正在尝试在我的 JSF 网页上添加 html5 拖放上传文件,所以我必须将此脚本添加到其中
<script type="text/html" id="template-uploads">
//<![CDATA[
<div data-bind="visible: showTotalProgress()">
<div>
<span data-bind="text: uploadSpeedFormatted()"></span>
<span data-bind="text: timeRemainingFormatted()" style="float: right;"></span>
</div>
<div class="uploadimage-totalprogress">
<div class="uploadimage-totalprogressbar" style="width: 0%;" data-bind="style: { width: totalProgress() + '%' }"></div>
</div>
</div>
<div data-bind="foreach: uploads">
<div class="uploadimage-upload" data-bind="css: { 'uploadimage-uploadcompleted': uploadCompleted() }">
<div class="uploadimage-fileinfo">
<strong data-bind="text: fileName"></strong>
<span data-bind="text: fileSizeFormated"></span>
<span class="uploadimage-progresspct" data-bind="visible: uploadProgress() < 100"><span data-bind="text: uploadSpeedFormatted()"></span></span>
</div>
<div class="uploadimage-progress">
<div class="uploadimage-progressbar" style="width: 0%;" data-bind="style: { width: uploadProgress() + '%' }"></div>
</div>
</div>
</div>
//]]>
</script>
如果我取出脚本周围的 cdata 标签,我会收到此错误:
与元素类型关联的属性“data-bind”的值 “span”不能包含“
【问题讨论】:
-
您的问题的标题似乎描述的问题与您所说的不同。
-
我在这里没有看到任何 JavaScript
-
Roman : 我编辑了我的帖子。
-
门把手:确实,你是对的。它有点像一个模板,但它会产生与 JS 中的“
标签: jsf knockout.js