用js调用迅雷下载代码的二种方法_Javascript教程-查字典教程网
用js调用迅雷下载代码的二种方法
用js调用迅雷下载代码的二种方法
发布时间:2016-12-30 来源:查字典编辑
摘要:方法一:复制代码代码如下:html>//初始化迅雷插件functionInitialActiveXObject(){varThunder;t...

方法一:

复制代码 代码如下:

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="下载" />

</body>

</html>

方法二:

复制代码 代码如下:

<html>

<head>

<SCRIPT src="http://www.jb51.net/js/thunderhref.js"></SCRIPT>

</head>

<body>

<a oncontextmenu=ThunderNetwork_SetHref(this) class=aThunder href="thunder://QUFodHRwOi8vZnRwY25jLXAyc3AucGNvbmxpbmUuY29tLmNuL3B1Yi9kb3dubG9hZC8yMDEwMTAvOTFhc3Npc3RhbnRfaXBob25lMjYzLmV4ZVpa" thunderResTitle="迅雷下载" thunderType="04" thunderPid="00008" thunderHref="thunder://QUFodHRwOi8vZnRwY25jLXAyc3AucGNvbmxpbmUuY29tLmNuL3B1Yi9kb3dubG9hZC8yMDEwMTAvOTFhc3Npc3RhbnRfaXBob25lMjYzLmV4ZVpa">迅雷下载</a>

</body>

</html>

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新Javascript教程学习
    热门Javascript教程学习
    编程开发子分类