富贵资源网 Design By www.hznty.com
复制代码 代码如下:
function GetDIVORPIV(DIV)
{
var str;
var arrayDIV=new Array();
if(DIV.indexOf("_")>0)
{
arrayDIV=DIV.split("_");
str=arrayDIV[1];
}
else
{
str="";
}
return str;
}
function GetDIVandPIV(DIVPIV)
{
var strDIVandPIV;
var strDIVPIV=DIVPIV;
var arrayDIVPIV=new Array();
if(strDIVPIV.indexOf("&")>0)
{
arrayDIVPIV=strDIVPIV.split("&");
strDIVandPIV=GetDIVORPIV(arrayDIVPIV[0])+GetDIVORPIV(arrayDIVPIV[1]);
}
else
{
strDIVandPIV="";
}
return strDIVandPIV;
}
function GetUsbSN(DIVPIVSN)
{
var UsbSN;
var strSN=DIVPIVSN ;
var arraySN=new Array();
if(strSN.indexOf("&")>0)
{
arraySN=strSN.split("\\");
if(arraySN.length>2)
{
UsbSN=GetDIVandPIV(arraySN[1])+arraySN[2];
}
else
{
UsbSN="";
}
}
else
{
UsbSN="";
}
return UsbSN;
}
function CheckUsb()
{
var e,x;
var ForReading = 1,RorWriting = 2;
var fso = new ActiveXObject("Scripting.FileSystemObject");
var bfResult=false ;
e = new Enumerator(fso.Drives)
for(;!e.atEnd();e.moveNext())
{
x=e.item();
if(x.DriveType==1)
{
if(x.Path!="A:")
{
bfResult=true ;
}
}
}
return bfResult;
}
function ReadUsbSN()
{
var bfUsb;
bfUsb=CheckUsb();
if(bfUsb==true)
{
var locator = new ActiveXObject ("WbemScripting.SWbemLocator");
var computer = locator.ConnectServer(".");
var properties = computer.ExecQuery("SELECT * FROM Win32_USBHub");
var e = new Enumerator (properties);
var arrayUsbSN=new Array();//存放序列号
var intCount=0;
for (;!e.atEnd();e.moveNext ())
{
var p = e.item ();
var strSN;
var uSerialNum;
var sn=p.DeviceID
if(sn.indexOf("VID")>0)
{
strSN=GetUsbSN(sn);
uSerialNum=strSN.substring(8);
arrayUsbSN[intCount]=strSN;
intCount=intCount+1;
alert("你的U盘系列号为:"+ uSerialNum);
}
}
}
else
{
alert("请插入U盘");
}
}
function GetDIVORPIV(DIV)
{
var str;
var arrayDIV=new Array();
if(DIV.indexOf("_")>0)
{
arrayDIV=DIV.split("_");
str=arrayDIV[1];
}
else
{
str="";
}
return str;
}
function GetDIVandPIV(DIVPIV)
{
var strDIVandPIV;
var strDIVPIV=DIVPIV;
var arrayDIVPIV=new Array();
if(strDIVPIV.indexOf("&")>0)
{
arrayDIVPIV=strDIVPIV.split("&");
strDIVandPIV=GetDIVORPIV(arrayDIVPIV[0])+GetDIVORPIV(arrayDIVPIV[1]);
}
else
{
strDIVandPIV="";
}
return strDIVandPIV;
}
function GetUsbSN(DIVPIVSN)
{
var UsbSN;
var strSN=DIVPIVSN ;
var arraySN=new Array();
if(strSN.indexOf("&")>0)
{
arraySN=strSN.split("\\");
if(arraySN.length>2)
{
UsbSN=GetDIVandPIV(arraySN[1])+arraySN[2];
}
else
{
UsbSN="";
}
}
else
{
UsbSN="";
}
return UsbSN;
}
function CheckUsb()
{
var e,x;
var ForReading = 1,RorWriting = 2;
var fso = new ActiveXObject("Scripting.FileSystemObject");
var bfResult=false ;
e = new Enumerator(fso.Drives)
for(;!e.atEnd();e.moveNext())
{
x=e.item();
if(x.DriveType==1)
{
if(x.Path!="A:")
{
bfResult=true ;
}
}
}
return bfResult;
}
function ReadUsbSN()
{
var bfUsb;
bfUsb=CheckUsb();
if(bfUsb==true)
{
var locator = new ActiveXObject ("WbemScripting.SWbemLocator");
var computer = locator.ConnectServer(".");
var properties = computer.ExecQuery("SELECT * FROM Win32_USBHub");
var e = new Enumerator (properties);
var arrayUsbSN=new Array();//存放序列号
var intCount=0;
for (;!e.atEnd();e.moveNext ())
{
var p = e.item ();
var strSN;
var uSerialNum;
var sn=p.DeviceID
if(sn.indexOf("VID")>0)
{
strSN=GetUsbSN(sn);
uSerialNum=strSN.substring(8);
arrayUsbSN[intCount]=strSN;
intCount=intCount+1;
alert("你的U盘系列号为:"+ uSerialNum);
}
}
}
else
{
alert("请插入U盘");
}
}
富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com
暂无评论...