获取页面URL参数值】的更多相关文章

JavaScript function GetParams(urlAddress) { var i, strLength, str, keyName, keyValue, params = {}, url = document.getElementById('sf_debug').src; if (url.indexOf("?") > -1) { var index = url.indexOf("?"); str = url.substring(index +…
我们可以用javascript获得其中的各个部分 1, window.location.href 整个URl字符串(在浏览器中就是完整的地址栏) 本例返回值: http://ifisker.com/blog/post/0703/window.location.html# 2,window.location.protocol URL 的协议部分 本例返回值:http: 3,window.location.host URL 的主机部分 本例返回值:www.x2y2.com 4,window.loca…
获取指定url参数值 /* 获取某url中的某参数值 调用:GetUrlQueryString("[url地址]","[参数名]"); */ function GetUrlQueryString(url,name){ var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); var r = url.substring(url.indexOf("…
下面我们举例一个URL,然后获得它的各个组成部分: http://i.cnblogs.com/EditPosts.aspx?opt=1 window.location.href (设置或获取整个 URL 为字符串) var test = window.location.href; alert(test); // 返回:http://i.cnblogs.com/EditPosts.aspx?opt=1 window.location.protocol (设置或获取 URL 的协议部分) var t…
一. 通过window.location获取各项参数 1.获取页面完整的url url = window.location.href; 2.获取页面的域名 host = window.location.host; host2=document.domain; 应用场景:页面跳转,开发环境和测试环境域名不同,所以需要动态获取后进行拼接跳转的url. 二.javascript正则获取url中的参数 //正则获取url中的参数 function URL_Request(strName) { var s…
使用Javascript可以方便获得页面的参数信息,常用的几种如下: 设置或获取对象指定的文件名或路径 window.location.pathname   设置或获取整个 URL 为字符串 window.location.href   设置或获取与 URL 关联的端口号码 window.location.port   设置或获取 URL 的协议部分 window.location.protocol   设置或获取 href 属性中在井号"#"后面的分段 window.location…
以请求http://localhost:8080/doctor/demo?code=1为例 一:用java代码获取 //获取URL中的请求参数.即?后的条件 code=1 String queryString = request.getQueryString() ; //获取URI. /doctor/demo String requestURI = request.getRequestURI() ; //获取URL(不带请求参数).即协议+ip地址+端口号+请求方法 http://localho…
设置或获取对象指定的文件名或路径. window.location.pathname例:http://localhost:8086/topic/index?topicId=361alert(window.location.pathname); 则输出:/topic/index 设置或获取整个 URL 为字符串.window.location.href例:http://localhost:8086/topic/index?topicId=361alert(window.location.href)…
<?php echo $this->getStoreUrl('checkout/cart');?> 获取结账页面的url:<?php echo $this->getUrl('checkout/cart');?> magento的常用函数: //Get the path of your magento page. echo $this->getUrl('mypage'); //Get the path of the image in your skin folder…
//获取url后边的参数 $.getUrlParam = function (name) {                  var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");                  var r = window.location.search.substr(1).match(reg);                 if (r != null) re…