使用ajax将Flash视频加载到div中 [英] Loading flash videos into div with ajax

查看:130
本文介绍了使用ajax将Flash视频加载到div中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个客户端希望能够从视频缩略图的播放列表中进行选择,并且已经替换了页面上的视频。我还需要观看加载时间,所以认为如果用Ajax单击它,会更好地请求每个视频?我是新来的ajax,所以不太确定这是最好的选择。

我的页面如下:

 < div id =container> 
< div id =video>
< / div>
< div id =videoSelector>
< / div>
< / div>

videoSelector div将显示缩略图,用户将点击并将视频加载到视频div中。

任何帮助都会很棒

谢谢

解决方案

你并不需要AJAX来实现这个功能。你可以这样做:

 < script> 
function changeVideo(filename){
document.getElementById('video')。innerHTML ='CODE DEPENDING ON PLAYER'+ filename +'REMAINING CODE';
}
< / script>
< div id =video>< / div>
< div id =videoSelector>
< a href =javascript:void(); onclick =javascript:changeVideo('filename');>缩略图1< / a>
< a href =javascript:void(); onclick =javascript:changeVideo('filename2');>缩略图2< / a>
< a href =javascript:void(); onclick =javascript:changeVideo('filename3');>缩略图3< / a>
< / div>

像上面这样简单。你绝对可以改善上面的类选择器,jQuery等,但我希望这是一个开始。


I have a client that wants to be able to select from a playlist of video thumbnails and it replaces a video that is on the page already. I also need to watch loading times, so thought it would be better requesting each video if and when it's clicked with ajax? I'm new to ajax so not really sure if this is the best option.

My page is as follows:

<div id="container">
<div id="video">
</div>
<div id="videoSelector">
</div>
</div>

The videoSelector div will have thumbnails that the user will click and the video will load into the video div.

Any help will be great

Thanks

解决方案

You do not really need AJAX to achieve this functionality. You can do with something like:

<script>
 function changeVideo(filename) {
 document.getElementById('video').innerHTML = 'CODE DEPENDING ON PLAYER'+filename+'REMAINING CODE';
}
</script>
<div id="video"></div>
<div id="videoSelector">
<a href="javascript:void();" onclick="javascript:changeVideo('filename');">Thumbnail 1</a>
<a href="javascript:void();" onclick="javascript:changeVideo('filename2');">Thumbnail 2</a>
<a href="javascript:void();" onclick="javascript:changeVideo('filename3');">Thumbnail 3</a>
</div>

Something as simple as above. You can definitely improve the above using class selectors, jQuery etc. But I hope this is a start.

这篇关于使用ajax将Flash视频加载到div中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆