document.location的属性
示例html完整路径为:
http://10.10.3.117:8500/html/ypt/index.html
alert("document.location.href:"+document.location.href);
描述:设置或返回主机名和当前URL 的端口号
结果:http://10.10.3.117:8500/html/ypt/index.html
alert("document.location.hash:"+document.location.hash);
描述:设置或返回从井号(#) 开始的URL(锚)
结果:
alert("document.location.host:"+document.location.host);
描述:设置或返回主机名和当前URL的端口号
结果:10.10.3.117:8500
alert("document.location.hostname:"+document.location.hostname);
描述:设置或返回当前URL的主机名
结果:10.10.3.117
alert("document.location.pathname:"+document.location.pathname);
描述:设置或返回当前URL的路径部分
结果:/html/ypt/index.html
alert("document.location.port:"+document.location.port);
描述:设置或返回当前URL的端口号
结果:8500
document.location的属性的更多相关文章
- js中的 window.location、document.location、document.URL 对像的区别(转载)
原文:http://www.cr173.com/html/18417_1.html 当我们需要对html网页进行转向的时候或是读取当前网页的时候可以用到下面三个对像: window.location. ...
- JavaScript document和window属性及方法详解
[document对象] 该对象是window和frames对象的一个属性,是显示于窗口或框架内的一个文档. 属性 alinkColor 活动链接的颜色(ALINK) anchor 一个HTMI锚点 ...
- window.location和document.location的区别分析
用户不能改变document.location(因为这是当前显示文档的位置).但是,可以改变window.location (用其它文档取代当前文档)window.location本身也是一个对象,而 ...
- BOM对象,math对象document对象的属性和操作和 事件的基本操作
Math对象 //该对象中的属性方法 和数学有关. abs(x) 返回数的绝对值. exp(x) 返回 e 的指数. floor(x) 对数进行下舍入. log(x) 返回数的自然对数(底为e). m ...
- window.location和window.location.href和document.location的关系
1,首先来区分window.location和window.location.href. window.location.href是一个字符串. 而window.location是一个对象,包含属性有 ...
- document.location window.location
document.location 和 window.location 取url的值的时候可以通用,但是 document是window的属性,所以不能直接用document.location =ur ...
- Location protocol 属性
Location protocol 属性 定义和用法 protocol 属性是一个可读可写的字符串,可设置或返回当前 URL 的协议. 语法 location.protocol <!DOCTYP ...
- document对象常用属性
转载请注明来源:https://www.cnblogs.com/hookjc/ 注:页面上元素name属性和JavaScript引用的名称必须一致包括大小写 否则会提示你一个错误信息 " ...
- document.location.reload();与location.href='xxx'的区别
document.location.reload();会重新加载页面,onload事件会被触发. location.href='xxx'刷新页面,onload事件不会触发.
随机推荐
- innodb master thread 工作原理
参考 innodb参数汇总 InnoDB的Master Thread工作原理 innodb_max_dirty_pages_pct 默认值 show variables like 'innodb_m ...
- geetoo编译安装
关于Gentoo发行版的介绍请看:全球最受欢迎的十大Linux发行版(图) Host机环境:Win2008 + VMware 7.1 下载安装包 下载安装 CD 和 stage3 包: http:// ...
- datagrid中需要填写长文本,扩展的textarea
$.extend($.fn.datagrid.defaults.editors, { textarea: {//textarea就是你要自定义editor的名称 init: function(cont ...
- 【转】android的消息处理机制(图+源码分析)——Looper,Handler,Message
原文地址:http://www.cnblogs.com/codingmyworld/archive/2011/09/12/2174255.html#!comments 作为一个大三的预备程序员,我学习 ...
- 【转】第一个Linux内核驱动程序
原文网址:http://blog.csdn.net/nexttake/article/details/8181008 刚看 O’REILLY 写的<LINUX 设备驱动程序>时.作者一再强 ...
- 树莓PI上跑爬虫
主要是进行主机上使用myeclipse开发后,在从机上跑最后的程序 在主机上和树莓上都安装好java环境,maven,ant 拷到RPI上的时候修改
- 【opencv】图像细化
[原文:http://blog.csdn.net/qianchenglenger/article/details/19332011] 在我们进行图像处理的时候,有可能需要对图像进行细化,提取出图像的骨 ...
- 【转】ExcelHelper类,用npoi读取Excel文档
//------------------------------------------------------------------------------------- // All Right ...
- C/C++:原码、反码和补码
正数的原码.反码和补码是一模一样的. 负数的反码的符号位跟原码一样,但其余各位取反. 负数的补码是其反码的最末位加1得到,即原码取反加1. 补码的补码就是原码. 浮点数的存储格式随着机器的 ...
- Linux Vi 删除全部内容,删除某行到结尾,删除某段内容 的方法
1.打开文件 vi filename 2.转到文件结尾 G 或转到第9行 9G 3.删除所有内容(先用G转到文件尾) ,使用: :1,.d 或者删除第9行到第200行的内容(先用200G转到第200行 ...