用js获取本地电脑信息(但是只能在IE浏览器下才行,其他浏览器其获取不到的): 复制代码 代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>ieTest</title> <script type="text/javascript"> window.onload = getusername; function getusername(){ //js获取电脑信息 var WshNetwork = new ActiveXObject("WScript.Network"); var WshShell = new ActiveXObject ("WScript.Shell"); var $lDomain = document.getElementById('lDomain'), $lcName = document.getElementById('lcName'), $luName = document.getElementById('luName'), $lDomainDn = document.getElementById('lDomainDn'); $lDomain.value =WshNetwork.UserDomain; $lcName.value =WshNetwork.ComputerName; $luName.value =WshNetwork.UserName; $lDomainDn.value =WshShell.RegRead ("HKCU\Volatile Environment\USERDNSDOMAIN"); WshNetwork = null; WshShell = null; }; </script> </head> <body> <input type='text' id='lDomain' value='' /> <input type='text' id='lcName' value='' /> <input type='text' id='luName' value='' /> <input type='text' id='lDomainDn' value='' /> </body> </html>
推荐阅读
给jQuery方法添加回调函数一款插件的应用
插件源码 jquery.callback.js 插件开源地址: https://gist.github.com/4580276 复制代码 代码如下: /** * @fileOverview 本插件用于给jQuery方法添加回调函数,可在类方法或实例方法添加任何自定义的回调函数而不>>>详细阅读
本文标题:用js获取电脑信息(是使用与IE浏览器)
地址:http://www.17bianji.com/kaifa2/JS/22493.html
1/2 1