中文(繁体)
網頁特效程式碼實例,用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.downcodes.com/','建站學院')"> <input name ="btn" type="button" id="btn" value="C碟" onClick="toDesktop('file://C:','C碟')">