html value set from javascript?
30,026
Solution 1
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
Solution 2
You can use javascript to set the value of that element to p
.
<script type="text/javascript">
document.getElementById("Text1").value = p;
</script>
Solution 3
document.getElementById('Text1').value = p;
Solution 4
Using Javascript:
<script type="text/javascript">
document.getElementById("Text1").value = p;
</script>
Using jQuery:
<script type="text/javascript">
$("#Text1").val(p);
</script>
Author by
T.T.T.
Updated on July 09, 2022Comments
-
T.T.T. almost 2 years
<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.