復制代碼 代碼如下:
function toDesktop(sUrl,sName){
try{
var WshShell = new ActiveXObject("WScript.Shell");
var oUrlLink = WshShell.CreateShortcut(WshShell.SpecialFolders("Desktop") + "\\" + sName + ".url");
oUrlLink.TargetPath = sUrl;
oUrlLink.Save();
}catch(e){
alert("當前IE安全級別不允許操作!");
}
}
<a href="javascript:void(0);" onclick="toDesktop('http:\//www.163.com/','163網易')">創建快捷方式</a>
復制代碼 代碼如下:
<!---把以下文本復制到記事本裡面,然後保存成 .htm 格式文件,用IE打開就可以預覽效果了--->
<script language="JavaScript">
function toDesktop(sUrl,sName){
try
{
var WshShell = new ActiveXObject("WScript.Shell");
var oUrlLink = WshShell.CreateShortcut(WshShell.SpecialFolders("Desktop") + "\\" + sName + ".url");
oUrlLink.TargetPath = sUrl;
oUrlLink.Save();
}
catch(e)
{
alert("當前IE安全級別不允許操作!");
}
}
</script>
<input name="btn" type="button" id="btn" value="星光下載" onClick="toDesktop('http:\//cjss.tsh88.cn/','超級搜索')">
<input name="btn" type="button" id="btn" value="C盤" onClick="toDesktop('file:\//C:','C盤')">