I want to update the value of an hidden field using javascript, I don’t understand why my code doesn’t work.
<form id="install" action="" method="post">
<input id="idposte" type="hidden" value="">
</form>
<script type="text/javascript">
var wshnetwork=new ActiveXObject("wscript.network");
var identifiant=wshnetwork.computername;
document.getElementById('idposte').value=identifiant;
</script>
I think document.getElementById('idposte').value=identifiant;is not executed. I’m using IE8, this code is for an Intranet website (this is why I need the computer name).
Thank you very much.
If your function does not work, that’s caused by disabled
ActiveXcontrols.If you’re not receiving the data at the server’s side, that’s because you haven’t attached a
nameattribute to your<input>element.