这个大体就是获取远程客户端的mac和ip地址 在html页面测试无问题 但是导入工程中 变成jsp页面之后 三个script只能执行第一个script 为什么 请大佬赐教 感谢
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>WelCome Useing</title>
<mate http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR>
</head>
<body>
<object id=locator classid=CLSID:76A64158-CB41-11D1-8B02-00600806D9B6 VIEWASTEXT />
<object id=foo classid=CLSID:75718C9A-F029-11d1-A1AC-00C04FB6C223 />
<script>
var service = locator.ConnectServer();
var MACAddr ;
var IPAddr ;
service.Security_.ImpersonationLevel=3;
service.InstancesOfAsync(foo, 'Win32_NetworkAdapterConfiguration');
</script>
<form id=formfoo name=formbar>
<INPUT value="macAdrr" name="txtMACAddr" type="hidden">
<INPUT value="ipAdrr" name="txtIPAddr" type="hidden">
</form>
<script event="OnCompleted(hResult,pErrorObject, pAsyncContext)" for=foo>
var macAdrr = document.forms[0].txtMACAddr.value=unescape(MACAddr);
var ipAdrr = document.forms[0].txtIPAddr.value=unescape(IPAddr);
alert(macAdrr);
alert(ipAdrr);
function a(){
alert("xingma");
}
a();
</script>
<script event=OnObjectReady(objObject,objAsyncContext) for=foo>
if(objObject.IPEnabled != null && objObject.IPEnabled != "undefined" && objObject.IPEnabled == true){
if(objObject.MACAddress != null && objObject.MACAddress != "undefined")
MACAddr = objObject.MACAddress;
if(objObject.IPEnabled && objObject.IPAddress(0) != null && objObject.IPAddress(0) != "undefined")
IPAddr = objObject.IPAddress(0);
}
</script>
</body>
</html>
问题已解决
兄弟!问下eclipse搭建怎么弄!我卡这好久了!
你指的是什么意思 开发工具ecplise 怎么弄获取mac地址吗 这个和工具没关系吧 和语言有关
在浏览器里按F12看