回复 6# nico_chao <SCRIPT language=JavaScript>
var int1,pos1,isPause,post,courseStatus;
var isToswf = 0;
var isVideo = 1;
var mediaWidth = 250;
var mediaHeight = 188;
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
document.write('<script language="VBScript"\>\n');
document.write('On Error Resume Next\n');
document.write('Sub main_FSCommand(ByVal command, ByVal args)\n');
document.write(' Call main_DoFSCommand(command, args)\n');
document.write('End Sub\n');
document.write('</script\>\n');
}
var focusFlag;
function checkFocus(){
if(parent.document.hasFocus() && !isPause){
window.aicc_cont.showBox.MediaPlayer.Controls.Play();
}else if(!parent.document.hasFocus() || isPause){
window.aicc_cont.showBox.MediaPlayer.Controls.Pause();
}
}
post = setInterval("sendtime()",1000);
function sendtime(){
if(isToswf == 1){
var currtime = parseInt(window.aicc_cont.showBox.MediaPlayer.Controls.currentPosition);
var totltime = parseInt(window.aicc_cont.showBox.MediaPlayer.CurrentMedia.Duration);
doLMSSetValue( "cmi.core.lesson_location" , currtime*1000 );
if(currtime >= totltime){
courseStatus = "completed";
doLMSSetValue( "cmi.core.lesson_status" , "completed" );
}
}
}
function runInt1(){
isToswf = 0;
clearInterval(int1);
var num = 0;
try{
num = parseInt(window.aicc_cont.showBox.MediaPlayer.CurrentMedia.Duration);
}catch(err){
//alert(pos1);
}
if(num==0){
int1 = setInterval("runInt1()", 300);
}else{
focusFlag = setInterval("checkFocus()", 500);//检查是否是焦点
window.aicc_cont.showBox.MediaPlayer.Controls.Play();
window.aicc_cont.showBox.MediaPlayer.Controls.currentPosition = pos1;
isToswf = 1;
}
}
function main_DoFSCommand(command, args) {
var command = String(command);
var args = String(args);
var arr = args.split(";");
switch(command){
case "0":
runComm(args);
isVideo = args;
break;
case "1":
window.aicc_cont.showBox.MediaPlayer.Controls.Stop();
break;
case "2":
isPause = true;
window.aicc_cont.showBox.MediaPlayer.Controls.Pause();
break;
case "3":
isPause = false;
window.aicc_cont.showBox.MediaPlayer.Controls.Play();
break;
case "4":
pos1 = args;
runInt1();
break;
case "5":
window.aicc_cont.showBox.MediaPlayer.settings.volume = args;
break;
case "11":
window.open("inchen/html/about.html","课程简介");
break;
case "22":
window.open("inchen/html/teacher.html","教师简介");
break;
case "33":
window.open("inchen/html/text.html#"+args,"详细文字");
break;
case "44":
window.open("inchen/html/donwload.html","资料下载");
break;
case "55":
window.open("inchen/html/help.html","帮助");
break;
case "66":
window.top.close();
break;
case "77":
if(confirm('您确定要退出学习吗?')) window.top.close();
break;
}
}
function runComm(num){
if(parent.type == 3){
isVideo = num;
if(isVideo == 1){
}else{
mediaHeight = 0;
}
var comm="<body bgColor="transparent"><iframe id="showBox" name="showBox" src="cont.html" frameborder="no" scrolling="no" noresize="noresize" width=""+mediaWidth+"" height=""+mediaHeight+"" marginwidth="0"></iframe></body>"
window.aicc_cont.document.write(comm);
}
}
window.document.writeln("<div id=Layer1 style="Z-INDEX: -1; LEFT:0px; TOP:0px; WIDTH: 800px; HEIGHT: 600px; POSITION: absolute;">");
loadPage("inchen/core3.swf");
window.document.writeln("</div>");
window.document.writeln("<div id=Layer2 style="Z-INDEX: 1; LEFT:"+parent.xxLayer+"px; TOP:"+parent.yyLayer+"px; POSITION: absolute;">");
window.document.writeln("<iframe src="comm.html" name="aicc_cont" id="aicc_cont" width="280" height="200" frameborder="no" scrolling="no" noresize="noresize" allowtransparency="true"></iframe>");
window.document.writeln("</div>");
</SCRIPT>
查看网页脚本后发现此段JS代码应该是关键
尤其是:post = setInterval("sendtime()",1000);
function sendtime(){
if(isToswf == 1){
var currtime = parseInt(window.aicc_cont.showBox.MediaPlayer.Controls.currentPosition);
var totltime = parseInt(window.aicc_cont.showBox.MediaPlayer.CurrentMedia.Duration);
doLMSSetValue( "cmi.core.lesson_location" , currtime*1000 );
if(currtime >= totltime){
courseStatus = "completed";
doLMSSetValue( "cmi.core.lesson_status" , "completed" );
}
}
}
对JS熟悉的坛友请问应该如何对var currtime 这个变量赋值以达到欺骗效果呢? |