www.webdeveloper.com
Results 1 to 2 of 2

Thread: How do i pass a javascript varible to a HTML one

  1. #1
    Join Date
    Jul 2011
    Posts
    3

    Question How do i pass a javascript varible to a HTML one

    What i am trying to do is get the username of the currently logged on user, then i want this to populate the "username" textbox on my form.

    below is the code i have so far:

    <script type="text/javascript">
    <!--
    var WinNetwork = new ActiveXObject("WScript.Network");
    un = (WinNetwork.userName);

    //-->
    </script>

    <input type="text" name="curruser" id="curruser" value="[ un ]">

    Any help would be much appreciated!

    many thanks in advance

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Code:
    <script type="text/javascript">
    onload=function(){
    var WinNetwork = new ActiveXObject("WScript.Network");
    var un = (WinNetwork.userName);
    document.getElementById('curruser').value=un;
    }
    </script>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles