小编Con*_*der的帖子

在javascript中添加HTML5视频源?

我正在为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.

html javascript html5 html5-video

17
推荐指数
1
解决办法
2万
查看次数

龙卷风中的局部变量范围(python)

只是想知道龙卷风模板中的变量范围是什么.我在模板中有这个代码,但它失败了!

    {% 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)

这是怎么回事?

html python templates tornado

3
推荐指数
1
解决办法
2248
查看次数

标签 统计

html ×2

html5 ×1

html5-video ×1

javascript ×1

python ×1

templates ×1

tornado ×1