我有这个玉文件
- if (transactions != "")
table
th Site Name
th Deadline
th Delete Transaction
each item in transactions
tr
td= item.item_name
td
span(id='countdown'+item.timeout)= item.timeout
td
span(style='cursor: pointer;', onclick='deleteTransaction('+item.uniqueId+')')= "X"
button(id='confirmButton', onclick='confirm();', value="Confirm", name="Confirm")= "Confirm"
script
fillCountdown(transactions);
我不明白为什么从不调用最后一行中的函数fillCountdown
。我不得不说这个页面在弹出窗口中加载了Chrome扩展程序,但我想没有任何变化。
有人能帮助我吗?感谢。
答案 0 :(得分:3)
问题似乎是玉器中使用的缩进。在脚本标记之后,您需要给出两个空格缩进,然后定义该函数。例如:
body
script(type='text/javascript')
function something() {
alert("Inappropriate Value")
}
同时检查脚本标记是否使用body标记正确缩进。如果要在脚本标记内定义一个函数,请检查脚本标记是否只有一个带有body标记的级别缩进。在您的代码片段中,不清楚脚本标记是嵌套在“if”情况下还是正确对齐与身体标签。当我复制你的代码片段时,你的函数“fillCountdown”缩进了4个带有脚本标记的空格。在玉中,缩进有两个空格。希望这能解决你的问题。