function getClientPcName() { //"请将您浏览器Internet选项中的“对没有标记为安全的ActiveX控件进行初始化和脚本运行”设置为“启用”!/n/n然后刷新本页登陆!" var WshShellPcName = new ActiveXObject("WScript.Network"); var ComputerName = WshShellPcName.ComputerName ; return ComputerName; } function getClientIp() { var WshShellIp = new ActiveXObject("rcbdyctl.Setting"); var ip = WshShellIp.GetIPAddress; return ip; }
这段代码放到html模板中,
记住是模板不是bin-debug,原因大家都比较清楚哈
flex前台代码
复制代码 代码如下:
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:supportClasses="com.esri.ags.skins.supportClasses.*" minWidth="955" minHeight="600" creationComplete="init()"> <fx:Script> <![CDATA[ import mx.controls.Alert; public function init():void { var strPCName:String = ExternalInterface.call("getClientPcName"); var strPCID = ExternalInterface.call("getClientIp"); mx.controls.Alert.show(strPCName+" "+strPCID); } ]]> </fx:Script> <s:layout> <supportClasses:AttachmentLayout/> </s:layout> <fx:Declarations> <!-- 将非可视元素(例如服务、值对象)放在此处 -->