Javascript 更改正在运行的视频按钮css
我使用的背景播放器的工作原理如下:Javascript 更改正在运行的视频按钮css,javascript,css,flash,video-streaming,Javascript,Css,Flash,Video Streaming,我使用的背景播放器的工作原理如下: function Background(flashID) { this.flashID = flashID; this.swfRef = null; this.onReady = function() { }; this.registerswfRef = function() { if (this.swfRef == null) this.sw
function Background(flashID) {
this.flashID = flashID;
this.swfRef = null;
this.onReady = function() { };
this.registerswfRef = function() {
if (this.swfRef == null)
this.swfRef = swfobject.getObjectById(this.flashID);
};
this.playMovieByNum = function(movieID) {
this.registerswfRef();
this.swfRef.playMovieByNum(movieID);
};
以下是调用视频的顺序:
var background = new Background('back_1');// id for the backgground movie
function onReady(id)
{
//this function will run when the background has finished loading the xml.
//console.log('backgorund is now ready '+id); // id is passed from flash file.
};
window.onload =function()
{
document.getElementById('video1').onclick=function(){background.start(); background.playMovieByNum(1); };
document.getElementById('video2').onclick=function(){background.start(); background.playMovieByNum(2); };
document.getElementById('video3').onclick=function(){background.start(); background.playMovieByNum(3); };
document.getElementById('video4').onclick=function(){background.start(); background.playMovieByNum(4); };
document.getElementById('video5').onclick=function(){background.start(); background.playMovieByNum(5); };
document.getElementById('video6').onclick=function(){background.start(); background.playMovieByNum(6); };
document.getElementById('video7').onclick=function(){background.start(); background.playMovieByNum(7); };
document.getElementById('video8').onclick=function(){background.start(); background.playMovieByNum(8); };
};
我需要的背景按钮相对运行的视频改变颜色
例如,如果视频“1”正在运行,则按钮“#video1”将获得背景“#EF4123”,如果不是背景则为“无”
我尝试添加它,但只在单击按钮时更改背景:
this.playMovieByNum = function(movieID) {
this.registerswfRef();
this.swfRef.playMovieByNum(movieID);
for(i = 1; i <= 8; i++)
{
if(i == movieID)
$("#video" + i).css("background", "#EF4123");
else
$("#video" + i).css("background", "");
}
};
this.playMovieByNum=函数(movieID){
这个.registerswfRef();
这个.swfRef.playMovieByNum(movieID);
对于(i=1;i