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事件不会触发.
随机推荐
- 在SQL Server实现最短路径的搜索
开始 这是去年的问题了,今天在整理邮件的时候才发现这个问题,感觉顶有意思的,特记录下来. 在表RelationGraph中,有三个字段(ID,Node,RelatedNode),其中Node和Rela ...
- Building QT projects from the command line
/************************************************************************ * Building QT projects fro ...
- Java [leetcode 32]Longest Valid Parentheses
题目描述: Given a string containing just the characters '(' and ')', find the length of the longest vali ...
- Java [leetcode 26]Remove Duplicates from Sorted Array
题目描述: Given a sorted array, remove the duplicates in place such that each element appear only once a ...
- Uva11732(trie)
题意:给你n个字符串 用strcmp()两两比较 ,求字符比较的总次数 分析: 数据量很大我们考虑用孩子兄弟表示法来表示字典树 #include <cstdio> #include < ...
- POJ 2486-Apple Tree(树状背包)
题意 n个节点的树,每个节点都有价值,求在树上最多走k步获得的最大价值(从1开始走,节点的价值只能获取一次) 分析: 开始以为是最基础的树形背包,但后来发现,不能只走子树,有可能还回到根节点,dp[i ...
- Msp430概述
总结一下MSP430给我的印象吧,感觉他就是一个迷你型的arm 1:MSP430采用的是精简指令,他只有27条核心的汇编指令,这一点和arm相同,arm同样是采用精简指令,而80c51采用的是冗余指令 ...
- Base-Android快速开发框架(三)--数据存储之SQLite
SQLite,是一款轻量级的关系型数据库,Android原生集成的一个数据库.具有轻量级.独立性.隔离性.安全性等特点.是Android做数据存储的必备知识之一. 在实际的项目中,我们常用于一些对象的 ...
- 问题:如何在固定大小的DIV层插入N多个图片
这是贴友问的一个问题,具体需求是: 如何在固定大小的DIV层插入N多个图片,使其一行排列,超出层宽时出现滑动条? 原以为利用overflow属性可以实现,但是测试失败.后来利用div层叠实现了效果. ...
- HIbernate学习笔记(六) 关系映射之多对多
六.多对多 - 单向 Ø 一般的设计中,多对多关联映射,需要一个中间表 Ø Hibernate会自动生成中间表 Ø Hibernate使用many-to-ma ...