7
<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.

1

4 Answers 4

9

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

<script type="text/javascript">
    document.getElementById("Text1").value = p;
</script>
Sign up to request clarification or add additional context in comments.

Comments

4
document.getElementById('Text1').value = p;

Comments

3

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

Comments

2

Using Javascript:

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

Using jQuery:

<script type="text/javascript">
    $("#Text1").val(p);
</script>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.