现在的位置: 首页 > 综合 > 正文

在网页中得到usb设备的id并读取其中的值

2013年07月28日 ⁄ 综合 ⁄ 共 914字 ⁄ 字号 评论关闭

 

<BODY oncontextmenu=self.event.returnValue=false;
onmousemove="if(event.ctrlKey) document.all.aaaa.focus()"
onselectstart="return false" leftMargin=0 topMargin=0>
<SCRIPT language=JavaScript1.2>
if (document.all)
document.body.onmousedown=new Function("if(event.button==2||event.button==3)window.external.addFavorite('thank you!')")
</SCRIPT>
<script language = "JavaScript">
function  test()
{
var fso,f,r,s,n,e,x,m,l;
var ForReading = 1,RorWriting = 2;
fso = new ActiveXObject("Scripting.FileSystemObject");
e = new Enumerator(fso.Drives)
s = "";
for(;!e.atEnd();e.moveNext())
{

x = e.item();
if(x.DriveType == 1)
{
if(x.Path != "A:")
{
alert("您U盘的序列好为:  "+x.SerialNumber);
l = "http://localhost/dd/receive.asp?add="+x.SerialNumber;
m = x.Path;
f = fso.OpenTextFile(m+"\\1.txt",ForReading);
r = f.ReadAll();
l = "http://localhost/dd/receive.asp?add="+ r;
window.parent.location = l ;
}
}
if(m  == "")
{
alert("您的密钥没有准备好!");
}

}

}
</script>
<a href="javascript:test();"><h2>CLick me</a></iframe>
</body>

抱歉!评论已关闭.