国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 語(yǔ)言 > JavaScript > 正文

JS獲取幾種URL地址的方法小結(jié)

2024-05-06 16:01:43
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
本篇文章主要是對(duì)JS獲取幾種URL地址的方法進(jìn)行了總結(jié)介紹,需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助

以下為JS獲取幾種URL地址的方法

復(fù)制代碼 代碼如下:


thisURL = document.URL;
thisHREF = document.location.href;
thisSLoc = self.location.href;
thisDLoc = document.location;

thisTLoc = top.location.href;
thisPLoc = parent.document.location;
thisTHost = top.location.hostname;
thisHost = location.hostname;

tmpHPage = thisHREF.split( "http://www.survivalescaperooms.com/" );
thisHPage = tmpHPage[ tmpHPage.length-1 ];
tmpUPage = thisURL.split( "http://www.survivalescaperooms.com/" );
thisUPage = tmpUPage[ tmpUPage.length-1 ];


下面為使用JS獲取MAC地址、IP地址及主機(jī)名的方法:

復(fù)制代碼 代碼如下:


<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
</head>

<body>

<object classid="CLSID:76A64158-CB41-11D1-8B02-00600806D9B6"></object>
<object classid="CLSID:75718C9A-F029-11d1-A1AC-00C04FB6C223"></object>                                                        

<form>
<br/>MAC地址:<input type="text">
<br/>IP地址:<input type="text">
<br/>主機(jī)名:<input type="text">
</form>

</body>
</html>
<script language="javascript">
var sMacAddr="";
var sIPAddr="";
var sDNSName="";

var service = locator.ConnectServer();
service.Security_.ImpersonationLevel=3;
service.InstancesOfAsync(foo, 'Win32_NetworkAdapterConfiguration');

</script>

<script FOR="foo" EVENT="OnObjectReady(objObject,objAsyncContext)" LANGUAGE="JScript">
         if(objObject.IPEnabled != null && objObject.IPEnabled != "undefined" && objObject.IPEnabled == true){
                           if(objObject.IPEnabled && objObject.IPAddress(0) !=null && objObject.IPAddress(0) != "undefined")
                                         sIPAddr = objObject.IPAddress(0);
                           if(objObject.MACAddress != null &&objObject.MACAddress != "undefined")
                     sMacAddr = objObject.MACAddress;
                           if(objObject.DNSHostName != null &&objObject.DNSHostName != "undefined")
                                         sDNSName = objObject.DNSHostName;
          }
</script>

<script FOR="foo" EVENT="OnCompleted(hResult,pErrorObject, pAsyncContext)" LANGUAGE="JScript">

        myForm.macAddress.value=sMacAddr;
myForm.ipAddress.value=sIPAddr;
        myForm.hostName.value=sDNSName;
</script>

發(fā)表評(píng)論 共有條評(píng)論
用戶(hù)名: 密碼:
驗(yàn)證碼: 匿名發(fā)表

圖片精選

主站蜘蛛池模板: 五原县| 江津市| 齐河县| 金坛市| 侯马市| 婺源县| 沂水县| 西丰县| 阿鲁科尔沁旗| 滨州市| 喀什市| 渑池县| 丰城市| 军事| 玉屏| 苏尼特右旗| 南安市| 乐东| 济南市| 台东县| 郓城县| 五指山市| 通河县| 乡城县| 科技| 拜泉县| 博爱县| 通江县| 昭通市| 佛坪县| 屏东县| 深州市| 营口市| 山阳县| 梓潼县| 湖南省| 茶陵县| 兴安县| 罗田县| 邻水| 广饶县|