- UID
- 247532
- 帖子
- 4
- 精华
- 0
- 贡献
- 0
- 推广
- 0
- 有效BUG
- 0
- 注册时间
- 2009-11-19
|
本帖最后由 lumengyimeng 于 2009-11-19 18:40 编辑
我们学校的网站网页里就有课件能下载东西的课件下载器,但是必须 在一些位置加入网址,这些网址是一样的,每次都要手动改了,然后保存为html然后再打开,感觉好麻烦,好像大家说脚本写个插件会比较简单,本人只学过一点c,希望得到大侠脚本上的帮助。我把网页的源代码帖上,大家帮我看看怎么写。
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css/middle.css" rel="stylesheet" type="text/css">
<title>节目信息</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 10px;
}
.line{
font-size: 13px;
line-height: 200%;
}
-->
</style>
<script language ="javascript" src="jslib/truevod.js"></script>
<script language="JavaScript">
<!--
function CSitcomObj(vSelfId,vProgId,vSerialNo,vSubTitle,vUrl,vSvrId,vDiskId,vPlayType,vProgType,vBandWidth,vBeginTime,vEndTime)
{
//Sitcom Property
this.selfId=vSelfId;
this.progId=vProgId;
this.serialNo=vSerialNo;
this.subTitle=vSubTitle;
this.url=vUrl;
this.svrId=vSvrId;
this.diskId=vDiskId;
this.playType=vPlayType;
this.progType=vProgType;
this.bandWidth=vBandWidth;
this.beginTime=vBeginTime;
this.endTime=vEndTime;
}
function CDiskObj(vSelfId,vDiskName,vSvrId,vSvrName,vSvrAddress)
{
//Disk Property
this.selfId=vSelfId;
this.diskName=vDiskName;
this.svrId=vSvrId;
this.svrName=vSvrName;
this.svrAddress=vSvrAddress;
}
/////////全局变量
var sitcomList = new Array();
var diskList = new Array();
var isWebServer = 0==1;
var isNearPlay = 1==1;
var strProgName = '七秒钟Seconds(2005)';
var nProgID = "9109";
var nUserBandWidth = 60000;
var nSitcomNum = 1;
var nSitcomTrueNum=1;//真正的sitecomm数目录,去掉分发记录
function PlayAlert1()
{
alert("对不起!由于管理员授予您的带宽限制,不能点播节目:\r\n\""+strProgName+"\"");
}
function PlayAlert()
{
alert("对不起!由于您是匿名登录用户,不能点播节目:\r\n\""+strProgName+"\"");
}
function PlayError()
{
alert("对不起!您的权限级别不够高,因此不能点播节目:\r\n\""+strProgName+"\"");
}
function init()
{
setSitcomSelect();
if(nSitcomNum>1 && nSitcomTrueNum<2) document.getElementById("sitcomTr").style.display="none";
setPlayList(sitcomList[0].serialNo);
}
function OpenUrl(url)
{
window.open(url,"_blank");
}
function getFileExt(filePath)
{
if(filePath == null || filePath == "")
{
return "";
}
var pos = filePath.lastIndexOf('.');
if(pos > 0)
{
return filePath.substring(pos+1);
}
else
return "";
}
function setSitcomSelect()
{
if(!document.form1.sitcomSelect) return;
var vInd = 0;
var vPreSerialNo = 0;
var vSerialNo = 0;
for(var i=0;i<sitcomList.length;i++)
{
vSerialNo = sitcomList.serialNo;
if(vSerialNo != vPreSerialNo)//去掉重复
{
document.form1.sitcomSelect.options[vInd] = new Option(sitcomList.subTitle,vSerialNo);
vPreSerialNo = vSerialNo;
vInd++;
}
}
nSitcomTrueNum = vInd;
}
function setPlayList(curSerialNo)
{
var strPlayList='';
//因有节目分发,故同一节目同一集在sitcom中有多条记录
var arrSitcomObj = getArrSitcomObj('serialNo',curSerialNo);
if(arrSitcomObj == null || arrSitcomObj.length < 1)
{
alert("当前播放集数错误!");
return;
}
if(arrSitcomObj[0].bandWidth > nUserBandWidth)
{
strPlayList = '<a href="#PL"><img src="images/player.gif" border="0">地址1</a>';
}
else
{
if(isWebServer)
{
strPlayList = '<a href="#PL"><img src="images/player.gif" border="0">地址1</a>';
}
else if(isNearPlay)
{
strPlayList = '<a href="#PL"><img src="images/player.gif" border="0">地址1</a>';
}
else
{
strPlayList = getCommonPlayList(arrSitcomObj);
}
}
var playListNode = document.getElementById("playList");
playListNode.innerHTML = strPlayList;
}
function getCommonPlayList(arrSitcomObj)
{
var vInd = 1;
var strPlayList='';
var vSerialNo = 0;
var vDiskId = 0;
for(var i=0;i<arrSitcomObj.length;i++)
{
vDiskId = arrSitcomObj.diskId;
for(var j=0;j<diskList.length;j++)
{
if(diskList[j].selfId == vDiskId)
{
strPlayList += '<a href="#PL"><img src="images/player.gif" border="0">地址'+vInd+'</a> ';
vInd++;
}
if(diskList[j].selfId > vDiskId) break;//提高效率
}
}
return strPlayList;
}
//获取sitcom对象数组,,参数(属性,值) 暂实现serialNo
function getArrSitcomObj(prop,val)
{
var vInd = 0;
var arr = new Array();
var vValue;
var isSerialNo = (prop == 'serialNo');//属性是否serialNo
for(var i=0;i<sitcomList.length;i++)
{
vValue = eval("sitcomList."+prop);
if(vValue == val)
{
arr[vInd] = sitcomList;
vInd++;
}
if(isSerialNo && vValue > val) break;
}
return arr;
}
function play(strServer,nSubProgID,sDiskId,nFlag)
{
var arrSitcomObj = getArrSitcomObj('serialNo',nSubProgID);
if(arrSitcomObj == null || arrSitcomObj.length < 1)
{
alert("当前播放集数错误!");
return;
}
var sitcomObj = arrSitcomObj[0];
//判断如果播放类型是1流媒体播放,2是URL地址播放
if(sitcomObj.playType == 1)
{
if(sitcomObj.progType < 100)
{
BMTPPlayEx4ID(strServer,strProgName,nProgID,nSubProgID,sDiskId,sitcomObj.beginTime,sitcomObj.endTime,nFlag);
}
else
{
BMTPNullPlay(strServer,strProgName,getFileExt(sitcomObj.url),nProgID,nSubProgID,sDiskId,0);
}
}
else
{
OpenUrl(sitcomObj.url);
}
} |
|