网页特效代码实例,用Javascript创建桌面快捷方式。
<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:\//www.youkud.com/','网页编程网')">
<input name="btn" type="button" id="btn" value="C盘" onClick="toDesktop('file:\//C:','C盘')">
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:\//www.youkud.com/','网页编程网')">
<input name="btn" type="button" id="btn" value="C盘" onClick="toDesktop('file:\//C:','C盘')">