用JS获取地址栏参数的方法(超级简单) 方法一:采用正则表达式获取地址栏参数:( 强烈推荐,既实用又方便!) function GetQueryString(name) { var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if(r!=null)return unescape(r[
var url = window.location.href; //获取当前窗口的Url; 结果:http://localhost:61768/Home/Index?id=2&age=18 var host = window.location.host;//获取当前窗口的主机名; 结果:localhost:61768 var port = window.location.port; //获取当前窗口的端口; 结果:61768 var pathname = window.location.path
<script> var url = "http://127.0.0.1/index.php?old_quantity=168&date=1478309879000$id=2";//定义变量 function parse_url(_url){ //定义函数 var pattern = /(\w+)=(\w+)/ig;//定义正则表达式 var parames = {};//定义数组 url.replace(pattern, function(a, b, c){ pa
1问题:js get browser vertion (js获取浏览器信息版本) 2解决方案 Copy this script into your JavaScript files. It works immediately, and you can query three properties of the BrowserDetectobject: Browser name: BrowserDetect.browser Browser version: BrowserDetect.versio
/js获取浏览器语言(ie.ff.chrome) var language_en_us = "en-us"; var language_zh_cn = "zh-cn"; var currentLang; var en_lang = { 'test.name': "name",'test.age': "age"}; var zh_lang = { 'test.name'': "名字",'test.age'':