⽤js调⽤迅雷下载代码的⼆种⽅法⽅法⼀:
复制代码代码如下:
html>
</head>
<script type="text/javascript">
//初始化迅雷插件
function InitialActiveXObject()
{
var Thunder;
try
{
Thunder = new ActiveXObject("ThunderAgent.Agent")
}catch(e)
{
try
{
Thunder=new ActiveXObject("ThunderServer.webThunder.1");
}catch(e)
{
try
{
Thunder = new ActiveXObject("ThunderAgent.Agent.1");
}catch(e)
{
Thunder = null;
}
}
}
return Thunder;
}
//开始下载
function Download(url)
{
var Thunder = InitialActiveXObject();
if(Thunder == null)
{
DownloadDefault(url);
return;
}
try
{
Thunder.AddTask(url,"","","","",1,1,10);
Thunder.CommitTasks();
}catch(e)
{
try
{
Thunder.CallAddTask(url,"","",1,"","");
}catch(e)
{
DownloadDefault(url);
}
}
}
//容错函数,打开默认浏览器下载
function DownloadDefault(url)
{
//alert('打开浏览器下载.......');
}
</script>
</head>
<body>
<input type="button" value="下载"
onclick="Download('thunder://QUFodHRwOi8vZnRwY25jLXAyc3AucGNvbmxpbmUuY29tLmNuL3B1Yi9kb3dubG9hZC8yMDEwMTAvOTFhc3Npc3RhbnRfaXBob25lMjYzLmV4ZVpa')" />
</body>
</html>
⽅法⼆:
复制代码代码如下:
<html>
<head>
<SCRIPT src="www.jb51/js/thunderhref.js"></SCRIPT>
</head>
<body>
<a oncontextmenu=ThunderNetwork_SetHref(this) class=aThunder onclick="return OnDownloadClick_Simple(this)"
href="thunder://QUFodHRwOi8vZnRwY25jLXAyc3AucGNvbmxpbmUuY29tLmNuL3B1Yi9kb3dubG9hZC8yMDEwMTAvOTFhc3Npc3RhbnRfaXBob25lMjYzLmV4ZVpa" thunderResTitle="迅雷下载" thunderType="04" thunderPid="00008"
thunderHref="thunder://QUFodHRwOi8vZnRwY25jLXAyc3AucGNvbmxpbmUuY29tLmNuL3B1Yi9kb3dubG9hZC8yMDEwMTAvOTFhc3Npc3RhbnRfaXBob25lMjYzLmV4ZVpa">
迅雷下载</a>
</body>
如何下载javascript</html>

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。