<script type="text/javascript">
var id = getValue("ID");
document.write(id);
</script>
<form action="cgi-bin/runalg.cgi" method="post" enctype="multipart/form-data">
<input type="radio" name="genome" value="E.Coli"> <i>E.Coli</i> <input type="radio" name="genome" value="Human"> Human<br>
<input type="submit" name="submit" value="Submit"/>
<input type="reset" name="reset" value="Clear"/>
</form>
</body>
How do I get the value of the JavaScript variable (var id) into the form so that on submission I can retrieve it in the runalg.cgi
using the $q<-param("ID")
command?
you can write it directly:
<script type="text/javascript">
document.write('<input type="hidden" name="ID" value="'+id+'"/>');
</script>
Add a hidden field. Set the value in that field to the value of the variable in Javascript.
<form action="cgi-bin/runalg.cgi" method="post" enctype="multipart/form-data">
[...]
<input type="hidden" name="ID" value="default">
</form>
And then on javascript:
<script type="text/javascript">
document.forms[0].elements["ID"].value = getValue("ID");
</script>
The index for the form may vary in your document.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.