tags:

views:

42

answers:

2

I would like to know whether it is possible to pass parameters from a javascript function (in a HTML form). Your help would be highly appreciated.

A: 

Could you elaborate on what you are trying to do? Are you looking to return a set of values from a JavaScript function?

mishrsud
+1  A: 

If you want some values in your JavaScript to be added to the POST generated by the form, pop their values into hidden fields.

<form name="myform" method="post" onsubmit="return myFunction();">
<input type="hidden" name="calculatedTotal" value="">
<input type="submit" value="Go">
<script type="text/javascript">
   function myFunction() {
      document.myform.calculatedTotal.value = (100 / 4);
      return true;
   }
</script>
Sohnee