我正在为html5视频运行以下代码.
var media;
function videotr(){
media = document.createElement('video');
media.preload = true;
media.id = 'it';
document.getElementById('crop').appendChild(media)
return media;
}
var div = document.getElementById('crop');
$(div).empty();
this.image = new videotr();
this.image.src = args.src;
Run Code Online (Sandbox Code Playgroud)
但是,我想实现多个兼容源.如何通过java脚本添加多个源?我想以正确的方式做到这一点,而不是通过innerHtml.
只是想知道龙卷风模板中的变量范围是什么.我在模板中有这个代码,但它失败了!
{% set dictionary = {'a' : 1, ... more letters here ... 'z' : 26} %}
{% set sum = 0 %}
{% for y in x %}
{% sum += int(dictionary[y.lower()]) #x is a string, y a char %}
{% end %}
{{ sum }}
Run Code Online (Sandbox Code Playgroud)
但我得到:
ParseError: unknown operator: 'sum'
Run Code Online (Sandbox Code Playgroud)
这是怎么回事?