| | |
Pass parameters between Javascript and ASP
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Feb 2006
Posts: 13
Reputation:
Solved Threads: 0
Can anyone help me to solve the problem, i want to pass the parameters between the javascript and asp.
[html]<SCRIPT type="text/javascript" LANGUAGE="JavaScript">
<!--
function startWord(par_1)
{
var oShell = new ActiveXObject("Shell.Application");
var commandtoRun="C:\\Karan\\Automation.exe";
oShell.ShellExecute(commandtoRun, commandParms, "", "open", "1");
}
//-->
</script>
</head>
<body>
<form>
<input type="text" name="par_1" value="123">
<input type="button" value="Click me!" onclick="startWord(par_1)">
</form>
</body>
</html>[/html]
it's only open the vb.exe file, but how can i pass the parameters to this exe??
thank you for helping me~~~
[html]<SCRIPT type="text/javascript" LANGUAGE="JavaScript">
<!--
function startWord(par_1)
{
var oShell = new ActiveXObject("Shell.Application");
var commandtoRun="C:\\Karan\\Automation.exe";
oShell.ShellExecute(commandtoRun, commandParms, "", "open", "1");
}
//-->
</script>
</head>
<body>
<form>
<input type="text" name="par_1" value="123">
<input type="button" value="Click me!" onclick="startWord(par_1)">
</form>
</body>
</html>[/html]
it's only open the vb.exe file, but how can i pass the parameters to this exe??
thank you for helping me~~~
Last edited by cscgal; May 4th, 2006 at 10:43 am. Reason: Added code tags
•
•
Join Date: Dec 2004
Posts: 1,655
Reputation:
Solved Threads: 35
Please use the forum's CODE tags when posting.
JavaScript runs on the client. ASP runs on the server. You cannot "pass" variables between them, per se.
The only time ASP runs is when a REQUEST is sent to the web server, either a GET or a POST.
The way you send values to an ASP form is by adding a QueryString to your GET Requests, or by populating form values for your POST Requests (or, "form submits").
JavaScript runs on the client. ASP runs on the server. You cannot "pass" variables between them, per se.
The only time ASP runs is when a REQUEST is sent to the web server, either a GET or a POST.
The way you send values to an ASP form is by adding a QueryString to your GET Requests, or by populating form values for your POST Requests (or, "form submits").
•
•
Join Date: Dec 2004
Posts: 1,655
Reputation:
Solved Threads: 35
I see. Well, you're passing in a value to the function, correct? Is that value you want to "pass" to the activeX object? I see you're executing the method with "commandParms", but you're never setting "commandParms" equal to anything. Should it contain the value you pass to the JavaScript function?
Okay, I'm going to assume that you want commandParms = "123".
Okay, I'm going to assume that you want commandParms = "123".
<SCRIPT type="text/javascript" LANGUAGE="JavaScript"> <!-- function startWord(x) { commandParms = document.getElementById(x).value; var oShell = new ActiveXObject("Shell.Application"); var commandtoRun="C:\\Karan\\Automation.exe"; oShell.ShellExecute(commandtoRun, commandParms, "", "open", "1"); } //--> </script> </head> <body> <form> <input type="text" name="par_1" value="123"> <input type="button" value="Click me!" onclick="startWord('par_1')"> </form> </body> </html>
•
•
Join Date: Dec 2004
Posts: 1,655
Reputation:
Solved Threads: 35
I assure you this works. I have no idea what "getelement" means, sorry.
Here's the most simplified test version I can make for you:
Here's the most simplified test version I can make for you:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<html> <head> <script type="text/javascript"> function startWord(x) { var commandParms = document.getElementById(x).value; alert(commandParms); } </script> </head> <body> <form> <input id="txt" type="text" value="123" /> <input id="btn" type="button" value="Click" onclick="startWord('txt')" /> </form> </body> </html>
![]() |
Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Page Loading
- Next Thread: Firefox vs. IE-menu not working please help
Views: 22111 | Replies: 10
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
ajax ajaxexample ajaxjspservlets api blackjack browser bug captchaformproblem checkbox child class close cookies createrange() cursor date debugger dependent developer disablefirebug dom dropdown editor element embed engine events explorer ext file flash form forms game gears getselection google gxt hiddenvalue highlightedword hint html ie7 ie8 iframe images internet java javascript javascripthelp2020 jquery jsf jsfile jump libcurl maps margin math matrixcaptcha media mp3 mysql object onerror onmouseoutdivproblem onreadystatechange parent passing paypal pdf php player position post programming progressbar rated runtime safari scriptlets scroll search security session shopping size software solutions star stars stretch synchronous tweet unicode web webkit webservice window wysiwyg \n






