Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Install Using OnClick Function

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 03-04-2009
Member
 
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

Reply With Quote
  #2  
Old 03-04-2009
Member
 
Join Date: May 2008
Posts: 2,383
Re: Install Using OnClick Function

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

Quote:
<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>
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
  #3  
Old 03-04-2009
Member
 
Join Date: Feb 2008
Posts: 1,845
Re: Install Using OnClick Function

Hey , Check This Link it might Be helpful http://www.microsoft.com/technet/scr...5/hey1031.mspx
Reply With Quote
  #4  
Old 03-04-2009
Member
 
Join Date: Oct 2005
Posts: 2,389
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.
Reply With Quote
  #5  
Old 03-04-2009
Member
 
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Install Using OnClick Function"
Thread Thread Starter Forum Replies Last Post
CSS Button onclick event href="#" onclick=" Cornnelius Software Development 6 14-05-2010 11:20 PM
using href vs. onclick to call javascript function Kalyug Software Development 6 12-05-2010 10:09 AM
Onclick event with DIV tag ISAIAH Software Development 5 03-03-2010 03:45 PM
Retrieve a value with onclick Sujit15 Software Development 5 05-01-2009 02:47 PM
Onclick and Firefox3 Coolestman Software Development 3 02-09-2008 02:46 PM


All times are GMT +5.5. The time now is 02:04 PM.