The following script allows you to extract the username of the current Windows user within an HTML page using Javascript.
<script>
var wshshell=new ActiveXObject("wscript.shell");
var username=wshshell.ExpandEnvironmentStrings("%username%");
alert(username);
</script>