获取页面地址url的指定部分信息,总结在一个方法体中:

    /**
* 获取项目跟路径,http://localhost:8080/myproject
*@returns
*/
var getCurUrlInfo = function () {
  //获取当前网址,如: http://localhost:8088/myproject/index/login.html
var curWwwUrl=window.document.location.href; //获取主机地址之后的目次,如: myproject/index/login.html
var UrlName=window.document.location.Urlname;
var hostUrlIndex=curWwwUrl.indexOf(UrlName); //获取主机地址,如: http://localhost:8088
var localhostUrl=curWwwUrl.substring(0,hostUrlIndex); //获取带"/"的项目名,如:/myproject
var projectName=UrlName.substring(0,UrlName.substr(1).indexOf("/")+1); return(localhostUrl+projectName);
}

获取页面地址url的指定部分信息的更多相关文章

  1. c#获取页面重定向url

    /// <summary> /// 获取页面重定向url /// </summary> /// <param name="url"></p ...

  2. 获取域名,url,指定url参数的方法

    1.js获取域名的方法 1) var domain = document.domain 2) var domain = window.location.host 2.获取url的方法 1) var u ...

  3. WordPress基础:get_page_link获取页面地址

    函数:get_page_link(页面id编号) 作用:获取指定页面的链接地址 用法: $link = get_page_link(2); 输出为:xxx/?page_id=2 如在循环里则不用填写i ...

  4. window.location对象 获取页面地址

    window.location对象的属性: 属性 含义 值 location.protocol 协议 "http://"或"https://" location ...

  5. Js获取页面地址参数

    var url = window.location.href; //获取当前窗口的Url; 结果:http://localhost:61768/Home/Index?id=2&age=18 v ...

  6. 获取图片地址url的后缀名

    getNameFromLink(url){ if(url.indexOf('.cn/') !== -1){          return (url.split('.')[url.split('.') ...

  7. 用 DOM 获取页面的元素方法集合

    document.getElementById('id名')            // 获取页面设置指定 id 的元素 document.getElementsByTagName('标签名')    ...

  8. 获取页面URL两种方式

    以请求http://localhost:8080/doctor/demo?code=1为例 一:用java代码获取 //获取URL中的请求参数.即?后的条件 code=1 String querySt ...

  9. django学习-12.访问不同url/接口地址实现对指定数据的增删改查功能

    1.前言 通过前面博客[django学习-10.django连接mysql数据库和创建数据表]里的操作,我们已经成功在数据库[hongjingsheng_project]里创建了一张数据表[hello ...

随机推荐

  1. oracle fm格式化

    select to_char(0.56,'FM999,999,990.00' ) from dual 其中 9代表如果存在数字则显示数字,不存在显示空格 其中 0代表如果存在数字则显示数字,不存在则显 ...

  2. RestTemplate异常no suitable HttpMessageConverter found for request type [java.lang.Integer]

    GET方式,参数必须放在URL后面,http://xxx/list?name={name}&age={age} package com.chelizi.xiruo.xframework.uti ...

  3. Asp.net MVC]Asp.net MVC5系列——在模型中添加

    目录 概述 在模型中添加验证规则 自定义验证规则 伙伴类的使用 总结 系列文章 [Asp.net MVC]Asp.net MVC5系列——第一个项目 [Asp.net MVC]Asp.net MVC5 ...

  4. windows乱码

    对于支持 UNICODE的应用程序,Windows 会默认使用 Unicode编码.对于不支持Unicode的应用程序Windows 会采用 ANSI编码 (也就是各个国家自己制定的标准编码方式,如对 ...

  5. poj3261 Milk Patterns【后缀数组】【二分】

    Farmer John has noticed that the quality of milk given by his cows varies from day to day. On furthe ...

  6. ubuntu16.04下安装文献管理工具mendelay

    1.首先下载mendelay的安装包 到官网下载对应版本的安装包,官网地址:Download for Ubuntu and Kubuntu 16.04 LTS, 17.04 and Debian 2. ...

  7. ubuntu安装Anaconda2-4.4.0+TensorFlow

    1.下载Anaconda 到官网http://continuum.io/downloads下载anaconda. 2.安装anaconda 在终端输入:cd ~/Downloads;        b ...

  8. pyobjc-framework-Cocoa 5.1.2

    Introduction — PyObjC - the Python to Objective-C bridge https://pyobjc.readthedocs.io/en/latest/ py ...

  9. Spring Boot中的AutoConfiguation核心注解

    import org.springframework.boot.autoconfigure.condition.*; @ConditionalOnBean // 当容器中有指定bean的条件下 @Co ...

  10. 洛谷P3389 高斯消元 / 高斯消元+线性基学习笔记

    高斯消元 其实开始只是想搞下线性基,,,后来发现线性基和高斯消元的关系挺密切就一块儿在这儿写了好了QwQ 先港高斯消元趴? 这个算法并不难理解啊?就会矩阵运算就过去了鸭,,, 算了都专门为此写个题解还 ...