dcsimg
www.webdeveloper.com
Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17

Thread: Getting local IP address in javascript?

  1. #16
    Join Date
    Jan 2013
    Posts
    3
    Junk male.. Thanks for the link.. There are allots of info, Which I need...

  2. #17
    Join Date
    Aug 2013
    Posts
    1
    This code will work, I've also struggled with the same thing but now i got it

    <script type="text/javascript">
    function openall()
    {
    var strComputer = ".";
    var SWBemlocator = new ActiveXObject("WbemScripting.SWbemLocator");
    var objWMIService = SWBemlocator.ConnectServer(strComputer, "/root/CIMV2");
    var strProcess = "";
    var colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem");

    var e = new Enumerator(colItems);
    for(; ! e.atEnd(); e.moveNext())
    {
    strProcess += "";
    }

    colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=true");
    e = new Enumerator(colItems);
    for(; ! e.atEnd(); e.moveNext())
    {
    strProcess +=e.item().IPAddress(0)+ "\n";
    }
    document.getElementById ('outip').value = strProcess;
    }
    </script>
    <script type = 'text/javascript'>
    <body onload = "openall();"
    <input name="outip" type="text" id="outip" value="" size="50">
    </body>

    For all your IT related questions, visit my facebook page https://www.facebook.com/pages/Once-...87436111432160

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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