本文介绍了如何使用JavaScript获取视频标签src?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我正在尝试使用JavaScript获取视频网址。 代码是...... < div class =flideo> < video x-webkit-airplay =allowpreload =src =http://pdl.vimeocdn.com/80388/120/224743790.mp4?token2=1394169786_c1f036dda110a70d45fd824ec6692b94&aksessionid=e766a96a167c751e poster =>< / video> < / div> 谢谢.. 解决方案 var vids = document.getElementsByTagName('video') // vids是一个HTMLCollection for(var i = 0; i< ; vids.length; i ++){ console.log(vids.item(i).src)} 似乎对我有用!注意,这会变成HTMLCollection。 .length 给出长度, item(i)给出 i 。 var vids = document.getElementsByTagName('video')/ / vids是HTMLCollectionfor(var i = 0; i< vids.length; i ++){console.log(vids.item(i).src)} < div class =flideo> < video x-webkit-airplay =allowpreload =src =http://pdl.vimeocdn.com/80388/120/224743790.mp4?token2=1394169786_c1f036dda110a70d45fd824ec6692b94&aksessionid=e766a96a167c751eposter = >< / video>< / div> I am trying to get video URL using JavaScript.Code is ...<div class="flideo"> <video x-webkit-airplay="allow" preload="" src="http://pdl.vimeocdn.com/80388/120/224743790.mp4?token2=1394169786_c1f036dda110a70d45fd824ec6692b94&aksessionid=e766a96a167c751e" poster=""></video></div>Thanks.. 解决方案 var vids = document.getElementsByTagName('video') // vids is an HTMLCollectionfor( var i = 0; i < vids.length; i++ ){ console.log( vids.item(i).src )}Seems to work for me! Note, that turns an HTMLCollection. .length gives the length and item(i) gives the item at i.var vids = document.getElementsByTagName('video') // vids is an HTMLCollectionfor( var i = 0; i < vids.length; i++ ){ console.log( vids.item(i).src )}<div class="flideo"> <video x-webkit-airplay="allow" preload="" src="http://pdl.vimeocdn.com/80388/120/224743790.mp4?token2=1394169786_c1f036dda110a70d45fd824ec6692b94&aksessionid=e766a96a167c751e" poster=""></video></div> 这篇关于如何使用JavaScript获取视频标签src?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-12 09:01