DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> 關於JavaScript >> 用js獲取電腦信息(是使用與IE浏覽器)
用js獲取電腦信息(是使用與IE浏覽器)
編輯:關於JavaScript     
用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>
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved