web 开发之js---js 调用视频播放

var popWindow;
var videoWindow;
var videoWindowF;
var currentVideo=null;
var currentVideoTitle="";
var currentItem="";
var currentChapter=1;
//window.οnlοad=initPage;
//初始化
function initPage(){
adjustIFrameSize()
bindIframeEvt()
}
function bindIframeEvt(){
// 为IFRAME绑定onload事件
var cnt=document.getElementById("rightmain");
if (cnt.addEventListener) {
cnt.addEventListener("load", adjustIFrameSize, false);
} else {
cnt.attachEvent("onload", adjustIFrameSize);
}
}

//iframe 控制
function adjustIFrameSize() {
var myIframe = document.getElementById("rightmain");
if (myIframe) {
if (myIframe.contentDocument && myIframe.contentDocument.body.offsetHeight) {
// W3C DOM (and Mozilla) syntax
if(myIframe.contentDocument.body.offsetHeight>screen.availHeight-404){
myIframe.height = myIframe.contentDocument.body.offsetHeight+100;
}else{
myIframe.height =screen.availHeight-374
}

} else if (myIframe.Document && myIframe.Document.body.scrollHeight) {
// IE DOM syntax
if(myIframe.Document.body.scrollHeight>screen.availHeight-404){
myIframe.height = myIframe.Document.body.scrollHeight+100;
}else{
myIframe.height=screen.availHeight-374
}
}
}
}

function showTips(target){
target.blur()
var theElement=target.nextSibling
if(theElement.style.display=="inline"){
theElement.style.display="none"
}else{
theElement.style.display="inline"
}
adjustIFrameSize()

}
function showHideAnswer(target){
target.blur()
var theElement=target.parentNode.parentNode.nextSibling
//alert(theElement.style.display)
if(theElement.style.display=="block"){
theElement.style.display="none"
}else{
theElement.style.display="block"
}
adjustIFrameSize()

}
function showHideNote(target){
target.blur()
var theElement=target.parentNode.parentNode.nextSibling
//alert(theElement.style.display)
if(theElement.style.display=="block"){
theElement.style.display="none"
}else{
theElement.style.display="block"
}
adjustIFrameSize()

}

function launchVideo(videoID,videoTitle,cc){
if(videoWindowF){
videoWindowF.close();
}
currentVideo=videoID;
currentVideoTitle=videoTitle;
currentChapter=cc;
var videoDirectory=""
if(currentItem=="videolist"){
videoDirectory="../../media/";
}else{
videoDirectory="../../media/";
}
//alert(window.location.href)
videoWindow= window.open(videoDirectory+"videoplayer.html","videos","width=470,height=510,resizable=no,scrollbars=no");
videoWindow.moveTo(0,0);
videoWindow.focus();
}
function launchVideo_f(videoID,videoTitle){
if(videoWindow){
videoWindow.close();
}
if(videoID){
currentVideo=videoID;
}
if(videoTitle){
currentVideoTitle=videoTitle;
}
var videoDirectory="";
var theW=780;
if(screen.availWidth){
theW=screen.availWidth-10;
}
var theH=560;
if(screen.availHeight){
theH=screen.availHeight-40;
}
videoWindowF= window.open(videoDirectory+"videoplayer_f.html","videos_f","width="+theW+",height="+theH+",resizable=yes,scrollbars=no");
videoWindowF.moveTo(0,0);
videoWindowF.focus();
}

function launchQuiz(quizID){
var quizURL=quizID+".html"
popWindow= window.open(quizURL,"popwin","width=579,height=600,resizable=no,scrollbars=yes");
popWindow.focus();
}
function launchReadings(readingID){

var readingURL="readings/"+readingID+".html";
popWindow= window.open(readingURL,"popwin","width=579,height=600,resizable=no,scrollbars=yes");
popWindow.focus();

}
function launchReference(referenceID){

var referenceURL="../references/"+referenceID+".html";
popWindow= window.open(referenceURL,"popwin","width=579,height=550,resizable=no,scrollbars=yes");
popWindow.focus();


}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值