JavaScript获取计算机MAC等硬件信息
(1)下载ClientInfo.dll(在我的资源中可以下载http://download.csdn.net/source/2141582)
(2)使用new ActiveXObject("ClientInfo.HostInfo")调用ActiveX库
(3)GetAdapterMac(0)获取网卡MAC地址
使用示例:
<HTML>
<TITLE>ClientInfoX JavaScript Sample</TITLE>
<HEAD>
<script language="JavaScript">
//////////////////////////////////////////////////
//函数与方法
//////////////////////////////////////////////////
function AddInfo(sInf)
{
xo=new ActiveXObject("ClientInfo.HostInfo")
document.getElementById("mbox").value = "\r" +sInf +document.getElementById("mbox").value;
}
function GetWindowsVersion()
{
xo=new ActiveXObject("ClientInfo.HostInfo")
AddInfo("GetWindowsVersion: "+xo.GetWindowsVersion());
//getusername();
}
function GetCPU_ID()
{
xo=new ActiveXObject("ClientInfo.HostInfo")
AddInfo("GetCPU_ID: "+xo.GetCPU_ID());
}
function GetAdapterMac()
{
xo=new ActiveXObject("ClientInfo.HostInfo")
AddInfo("GetNET_ID: "+xo.GetAdapterMac(0));
}
function GetIdeSerialNumber()
{
xo=new ActiveXObject("ClientInfo.HostInfo")
AddInfo("GetIdeSerialNumber: "+xo.GetIdeSerialNumber());
}
function ClearmBox()
{
document.getElementById("mbox").value = "";
}
</script>
</HEAD>
<BODY><center>
<FORM ACTION="#" NAME="forms"><table width="100%" border="1" cellpadding="0" cellspacing="0" onload height="330">
<tr>
<td width="9%" height="30"><center><h3>ClientInfoX.dll 实例 </h3></center></td>
</tr>
<tr>
<td width="9%" height="30"><center>
<p>消息窗口<br>
&n
相关文档:
<html>
<head>
<title>测试输入字符</title>
<script language=javascript>
String.prototype.lenB =function(){
return this.replace(/[^\x00-\xff]/g,"**").length;
}
function a() ......
最近的项目开发中 遇到一些需要根据具体情况动态添加javaScript脚本,然后执行脚本 于是收集了一下:
1 在控件的绑定事件中添加脚本 如:在gridview控件的rowdatabind事件中可以实现 指针的选中行不同色显示 可添加脚本
protected void gvEngineerRepairState_RowDataBound(object sender, GridViewRowEventArgs e ......
// JavaScript 脚本,解析型语言
//
var ABCD = function(){
var pub = {};
var pri = {};
pri.name = "myhere";
pri.age = 23;
//var ABCDE;
pub.setName = function( newName){
pri.name = newName;
};
// 这里 pub.getName 被赋值为一个函数,就是定义一个函数
// 这个函数并没有运行,这个函数 ......
--------------------------------------------------------------------------------
<body>
<mce:script type="text/javascript"><!--
document.write("如果显示了这段文字,那么您的浏览器支持 JavaScript!")
// --></mce:script>
<noscript>No JavaScript support!</noscript&g ......
function get_cookie(Name)
{
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0)
{
var offset = document.cookie.indexOf(search)
if (offset != -1)
{
&nbs ......