我真的不知道如何将HTML标签的SRC信息插入css3内容标签。
例如:得到
<video id="video" width="100%" height="100%" controls>
<source src="63f01c0300d2848a.webm" type="video/webm">
<p> Your browser doesn't support WebM video.</p>
</video>
并插入
<style type="text/css">
#videoname:after{content:"";}
</style>
我知道如何开始,但是我对js的了解不够。
function notEmpty(){
var srcname = document.getElementById("video").src;
if(srcname.value != "")
else
??insert ("no video selected")?? }
谢谢你的帮助!
使用Jquery很容易做到将此代码添加到您的<head>
<script src="http://code.jquery.com/jquery-1.11.1.min.js" ></script>
<script>
var source = $('#source').attr('src');
$('#videoname').html('<b>>> ' + source + '</b>');
</script>
和添加id="source"到你的source标签
<source id="source" src="63f01c0300d2848a.webm" type="video/webm">
并把这个div放到你想要的地方:
<div id="videoname"></div>
更新的小提琴在这里:http://jsfiddle.net/x32pb/2/