Question

<script type="text/javascript">
  var p = s.getMaximum();
</script>

<form action="/cgi-bin/Lib.exe" method="POST" name="checks" ID="Form1">
    <INPUT TYPE="text" NAME="inputbox" VALUE="VAR P FROM JAVA SCRIPT HERE?" ID="Text1"><P></form>

Possible to pass the javascript value 'p' as the value of input form?

Thanks.

Was it helpful?

Solution

You want to read about the Javascript DOM.

Start with the following: http://www.w3schools.com/htmldom/dom_obj_form.asp

Specifically you're looking to manipulate document.checks.inputbox.value

Edit: Page removed. Answer can be found here now: http://www.w3schools.com/jsref/coll_doc_forms.asp

OTHER TIPS

You can use javascript to set the value of that element to p.

<script type="text/javascript">
    document.getElementById("Text1").value = p;
</script>
document.getElementById('Text1').value = p;

Using Javascript:

<script type="text/javascript">
    document.getElementById("Text1").value = p;
</script>

Using jQuery:

<script type="text/javascript">
    $("#Text1").val(p);
</script>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top