|
楼主 |
发表于 2012-5-4 12:14
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
对话框的代码
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1"><title>
</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script language="javascript" src="http://116.255.169.106:801/WebRes/js/jquery.js"
type="text/javascript"></script>
<script language="javascript" src="http://116.255.169.106:801/WebRes/js/myScript.js"
type="text/javascript"></script>
<script language="javascript" src="http://116.255.169.106:801/WebRes/js/zDrag.js"
type="text/javascript"></script>
<script language="javascript" src="http://116.255.169.106:801/WebRes/js/zDialog.js"
type="text/javascript"></script>
<script language="javascript" src="http://116.255.169.106:801/WebRes/js/screen.js"
type="text/javascript"></script>
<script language="javascript" type="text/javascript">
var _TimeTest = null;//试题对象,二维数组,每个数组内容为题目,时间点,是否弹出过
var _ShowTimeTest=true;//是否弹出练习窗口
var trn_id="caa5d717f50f4d35b42d78bf01314fd1";
var _sysID=115;
var _usrid="efd34a7c68d64b069839d6976b00573e";
//控制暂停提示时间,目前仅泉州科技培训平台有用
var timeStop = 0;
var TimeTest=new Array();
var TimeTest =[];
TimeTest[0]=new Array("e8e95dbfea7c4c8fae3e752123d5546d","00:17:00","false","d0e0620b4d5d4159b859b2b9a9a70792");
TimeTest[1]=new Array("92f387e75eba4f558fc70f2fc89913eb","00:31:00","false","2bd30c20895d49f686ad3f2e2a9d1e9e");
_TimeTest = TimeTest;
function GetTimecalculate(num)
{
///<summary>
/// 将时间转换成文本格式 返回- 00:00:00 格式
///<summary>
/// <returns type="String" />
/// <param name="num" type="Number">
/// 以秒为单位 RealPlay需要把毫秒转换为秒
/// </param>
var validTime = num;
var h = 0;
var m = 0;
var s = 0;
if (validTime >= 60)
{
m = Math.floor(validTime / 60);
s = Math.floor(validTime % 60);
}
else
{
s = Math.floor(validTime);
}
if (m >= 60)
{
h = Math.floor(m / 60);
m = m % 60;
}
if (h < 10)
{
h = "0" + h;
}
if (m < 10)
{
m = "0" + m;
}
if (s < 10)
{
s = "0" + s;
}
return h + ":" + m + ":" + s;
}
var stat = "";
this._PlayTimer = null; //计时器
//页面初始加载时,即调用此方法监视播放进程
function init()
{
try
{
if(_med == null)
{
_med = window.frames["PlyFrame"].frames["contents"].document.all("MediaPlayer1");
}
//alert("current PlayState=" + _med.PlayState + "|oldStat=" + stat);
if(stat == "1" && _med.PlayState == "3")
{
//当上一次为停止而当前为播放则立即申请开始
addSave("0");
}
//播放状态
stat = _med.PlayState;
var tTime = GetTimecalculate(_med.controls.currentPosition);
//看视频过程中提示,目前仅泉州科技培训平台有用 yanxh
if ( ( _sysID == 144 || _sysID == 146 || _sysID == 147 ) && _med.PlayState == 3)
{
timeStop += 1;
if (timeStop >= 900)
{
_med.controls.pause(); //暂停视频
Dialog.alert('您还需要继续学习吗?', function() { _med.controls.play(); });
timeStop = 0;
}
}
//**********************弹窗处理*****************************//
if (_ShowTimeTest)
{
//如果试题不为空
if (_TimeTest != null)
{
for (var ti = 0; ti < _TimeTest.length; ti++)
{
//如果该时间点有试题则弹出来
if (tTime == _TimeTest[ti][1] && _TimeTest[ti][2] == "false")
{
_med.controls.pause(); //暂停视频
//隐藏播放窗体
$("#PlyFrame").css("display","none");
var ett_id=this._TimeTest[ti][3];
//创建对话框
var diag = new Dialog();
//diag.Width = 300;
diag.Height = 100;
diag.Left = 320;
diag.Drag = true;
diag.Title = "在线测试";
//远程请求试题与答案
var url = "exq_id=" + this._TimeTest[ti][0];
var a = CallServerMethod("GetQuestionInfo", url);
var rtValue = new GetReturnValue(a);
//rtValue.value结构为题目###答案
var ary = rtValue.value.split("###");
if (rtValue.state == "1")
{
diag.InnerHtml = '<div style="text-align:left;font-size:14px;padding:5px 5px 5px 5px;">' + ary[0] + '</div>';
}
else
{
diag.InnerHtml = '<div style="text-align:left;font-size:14px;padding:5px 5px 5px 5px;">访问服务器出错,无法获取题目</div>';
}
var ii=1;//回答次数
diag.OKEvent = function()
{
$("#PlyFrame").css("display","none");
var selChk = "";
//获取用户答案
var chks = document.getElementsByName("answer");
for (var i = 0; i < chks.length; i++)
{
if (chks[i].checked)
{
selChk += chks[i].value + ",";
}
}
selChk += " ";
if (selChk.trim() == ary[1].trim())
{
if(_sysID != 142){
Dialog.confirm('回答正确,您好棒哦,请继续努力!', function() {
diag.close();
$("#PlyFrame").css("display","block");
_med.controls.play();
});
}
else{
Dialog.alert('回答正确,您好棒哦,请继续努力!', function() {
var param="trn_id="+trn_id+"&usr_id="+_usrid+"&ett_id="+ett_id+"&sysID="+_sysID+"&state=1&answer=";
var q= CallServerMethod("SaveAnswer", param);
diag.close();
$("#PlyFrame").css("display","block");
_med.style.display="block";
_med.play();
});
}
}
else
{
if(ii<4)
{
Dialog.confirm("您答错了,要好好学习哦<br>", function() { $("#PlyFrame").css("display","none"); _med.controls.pause(); });
}
if(ii>=4)
{
Dialog.confirm("您答错了,要好好学习哦<br>正确答案是:" + ary[1], function() { $("#PlyFrame").css("display","none"); _med.controls.pause(); });
}
}
ii++;
};
//点击确定后调用的方法
diag.CancelEvent=function(){};//取消不做操作
diag.show();
this._TimeTest[ti][2] = "true";//标识为己弹出过
}
}
}
}
//**********************弹窗处理*****************************//
//首次加载为9,播放过程为3,暂停为2,停止为1,缓冲数据6
if(stat == "9" || stat == "3" || stat == "6")
{
stat = "0";
}
else
{
stat = "1";
}
if(query == null)
{
query = "sysId=115&usr_id=efd34a7c68d64b069839d6976b00573e&trn_id=caa5d717f50f4d35b42d78bf01314fd1&cre_id=c9c1c758f8a0428b92143ced5b0ff3c1&crw_id=035da3f90db64b929e28e2cf34010032&med_id=fac94d5365ac4bb5be787801651b0032";
}
if(stat == "0")
{
//定30秒钟保存一次
GetCurrentPosition();
_Timepiece ++ ;
}
//当当前播放停止或播放持续时间已经超过30秒钟时,保存一次
//alert("stat=" + stat + "|bolInit=" + bolInit + "|_Timepiece=" + _Timepiece);
if(bolInit == true || (stat == "1" && _Timepiece > 0) || _Timepiece >= 30)
{
//保存
//alert("addSave(stat)");
addSave(stat);
}
}
catch(e)
{
//alert("播放过程出现错误:\n" + e.message);
}
//不管是否已经取到播放器对象,定时器应总是起作用
if (this._PlayTimer == null)
{
this._PlayTimer = window.setInterval("init()", 1000);
}
}
//播放对象
var _med = null;
//
var bolInit = true;
//定义参数
var query = null;
//定义初始次播放产生的guid
var guid = "";
//当前学习时长(指从开始学习起,到现在的秒数量,一旦停止播放或保存,此参数重置为0)
var _Timepiece = 0;
//远程学习参数接收页面
var _ServerUrl = "http://116.255.169.85:801/OnlineHosting/StudentMedia.aspx";
//当前学习刻度
var currentPosition = 0;
//每次记录当前学习的刻度
function GetCurrentPosition()
{
if (_med.controls != null && _med.controls != undefined && typeof(_med.controls) == "object")
{
currentPosition = _med.controls.currentPosition;
}
else
{
currentPosition = _med.currentPosition;
}
}
//保存
function addSave(stat)
{
bolInit = false;
try
{
//学习时间刻度,暂时为0
var timepiece = 0;
//提交地址
var tmpUrl = this._ServerUrl + "?guid=" + guid + "&isEndStudy=" + stat + "&timepiece=" + _Timepiece + "¤tStudyLength=" + currentPosition + "&callback=?&" + query ;
//alert(tmpUrl);
$.getJSON(tmpUrl, null, function(data)
{
var rtValue = new GetReturnValue(data[0].value);
//alert("state=" + rtValue.state + "|value=" + rtValue.value + "|error=" + rtValue.error);
if (rtValue.state == "0")
{
guid = "";
//如果传递回0,表示该媒体需要被退出
//停止播放
if(_med != null)
{
try
{
if (_med.controls != null && _med.controls != undefined && typeof(_med.controls) == "object")
{
_med.Controls.Stop();
}
else
{
_med.Stop();
}
}
catch(e)
{
_med.pause();
}
}
}
else
{
guid = rtValue.value;
}
});
}
catch (e)
{
//alert("在保存学习时间过程中出现错误\n" + e.message);
}
finally
{
//将变量恢复为0(每次保存时均重置)
_Timepiece = 0;
}
}
function SetCurrentPosition()
{
try
{
if (_med == null)
{
_med = window.frames["PlyFrame"].frames["contents"].document.all("MediaPlayer1");
}
var currentTime = parseInt("1021");
if (_med.controls != null && _med.controls != undefined && typeof(_med.controls) == "object")
{
_med.controls.currentPosition = currentTime;
}
else
{
_med.currentPosition = currentTime;
}
_med.EnableContextMenu = false;
}
catch (e)
{
}
}
</script>
</head>
<body style="margin: 0 0 0 0;">
<form name="form1" method="post" action="PlyMediaDs.aspx?sys_id=115&usr_id=efd34a7c68d64b069839d6976b00573e&trn_id=caa5d717f50f4d35b42d78bf01314fd1&cre_id=c9c1c758f8a0428b92143ced5b0ff3c1&crw_id=035da3f90db64b929e28e2cf34010032&med_id=fac94d5365ac4bb5be787801651b0032&medUrl=http%3a%2f%2f116.255.169.198%2fppt%2fhngk%2f2012%2f02%2f010202%2findex.htm" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTIxODI4Njg1NWRkTwAhOXyQn2pPGf569g7DG/gqBfU=" />
</div>
<iframe id="PlyFrame" frameborder="0" width="100%" height="510" src="http://116.255.169.198/ppt/hngk/2012/02/010202/index.htm" onload="SetCurrentPosition();init();"></iframe>
</form>
</body>
</html>
<script language="javascript" type="text/javascript">
function f()
{
try
{
var _height = Geometry.getDocumentHeight();
$("#PlyFrame").css("height", _height);
}
catch (e)
{
}
}
f();
</script>
|
|