最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
两种js获取当前域名代码
时间:2014-07-09 编辑:简简单单 来源:一聚教程网
今天给各位朋友介绍两种js获取当前域名
代码如下 | 复制代码 |
//获取当前域名 1、window.location.host; //获取当前页面地址 url = window.location.href; |
例子
代码如下 | 复制代码 |
补充:
获取当前域名信息
代码如下 | 复制代码 |
thisTLoc = top.location.href; thisPLoc = parent.document.location; thisTHost = top.location.hostname; thisHost = location.hostname; strwrite = ” thisTLoc: [" + thisTLoc + "]” strwrite += ” thisPLoc: [" + thisPLoc + "]” strwrite += ” thisTHost: [" + thisTHost + "]” strwrite += ” thisHost: [" + thisHost + "]” document.write( strwrite ); |
-
下一个: HTML条件注释判断浏览器版本命令总结
相关文章
- js 获取图像缩放后的实际宽高,位置等信息 06-02
- 获取B站右上角所有小图的JS代码教程 01-05
- js获取鼠标选中的内容代码 10-13
- js获取当前月的第一天/最后一天例子 09-13
- js获取ckeditor内容与判断是否为空代码介绍 05-16
- js 获取光标所在textarea里的x y 坐标 08-26