//获取文件后缀
1.var FileExt=file_path.replace(/.+\./,
""
);
2.var fileExtension = file_path.substring(file_path.lastIndexOf(
'.'
) + 1);
//截取文件后缀
var reg = /\.\w+$/;
var file_name = file_path.replace(reg,
''
);
原文地址:
blog.csdn.net/qq_38836082…
获取视频ID:
<script>
$('#submit').click(function () {
var inputVal = $('#form-input').val();
if(inputVal.indexOf('//v.qq.com/') < 0 ){
alert("仅支持xx视频链接");
return;
var videoId = inputVal.replace(/(.*\/)*([^.]+).*/ig,"$2");
console.log('videoId: '+videoId);
videoPlayer(videoId);
function videoPlayer(vid) {
//video code
</script>