Results 1 to 5 of 5

Thread: Install Using OnClick Function

  1. #1
    Join Date
    Oct 2008
    Posts
    45

    Install Using OnClick Function

    Hello everyone

    Could you tell me if it is possible to launch the execution of a program using the OnClick event? I would like to when I click a button that installs the program The program is located in a folder in local programs

  2. #2
    Join Date
    May 2008
    Posts
    2,393

    Re: Install Using OnClick Function

    Hello , You'll get a security warning but you can do it:

    <html>
    <head>
    <title>run_exe.com/</title>
    <script type="text/javascript">
    function run(what) {
    var wss = new ActiveXObject("WScript.Shell");
    wss.Run(what);
    }
    </script>
    </head>
    <body>
    <form>
    <input type="button" value="Notepad" onclick="run('Notepad.exe')">
    <input type="button" value="Calculator" onclick="run('Calc.exe')">
    </form>
    </body>
    </html>

  3. #3
    Join Date
    Feb 2008
    Posts
    1,856

    Re: Install Using OnClick Function

    Hey , Check This Link it might Be helpful http://www.microsoft.com/technet/scr...5/hey1031.mspx

  4. #4
    Join Date
    Oct 2005
    Posts
    2,394

    Re: Install Using OnClick Function

    Your should use ShellExecute rather than execl. I think the exe* functions were designed for windows older than Windows 95. To use ShellExecute do

    #include <shellapi.h>

    ShellExecute(NULL, "open", "MyProgram", NULL, NULL, SW_SHOW);

    The 3rd parameter is any command line arguments your program takes.

  5. #5
    Join Date
    May 2008
    Posts
    115

    Re: Install Using OnClick Function

    In javascript, it is not possible to launch the execution of commands or programs when it is played on a browser. This is for security reasons. As against it is quite possible to simulate the behavior of a link when you click on a button, here's an example:


    Code:
    <html> 
    <head> 
    </ head> 
    <body> 
    <a href="./FileZilla_Server-0_9_25.exe"> click </ a> 
    <input type="button" value="clic" onClick="window.location.href='./FileZilla_Server-0_9_25.exe';"> 
    </ body> 
    </ html>


    When you click on the link or button your browser will offer you to run or download the executable.

Similar Threads

  1. CSS Button onclick event href="#" onclick="
    By Cornnelius in forum Software Development
    Replies: 6
    Last Post: 14-05-2010, 11:20 PM
  2. using href vs. onclick to call javascript function
    By Kalyug in forum Software Development
    Replies: 6
    Last Post: 12-05-2010, 10:09 AM
  3. Onclick event with DIV tag
    By ISAIAH in forum Software Development
    Replies: 5
    Last Post: 03-03-2010, 03:45 PM
  4. Retrieve a value with onclick
    By Sujit15 in forum Software Development
    Replies: 5
    Last Post: 05-01-2009, 02:47 PM
  5. Onclick and Firefox3
    By Coolestman in forum Software Development
    Replies: 3
    Last Post: 02-09-2008, 02:46 PM

Posting Permissions

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