html参数传递(html之间传递参数)

html参数传递(html之间传递参数)

首页维修大全综合更新时间:2024-01-17 04:32:43

html参数传递

还不是一样,用 querystringa页面:document.location.href="b.htm?param=p";在b页面里面,用js去分析location.href 就行了。给你个现成的: window.QeryStringParser = function(){ var url = window.location.href ; var rex = /[^x00-xff]+/ ; if(rex.exec(url))url = encodeURI(url) ; if(url.indexOf("?")0) s = s.substr(1) + "&" ; s += "_pre=" + window.location.href.substr(0,window.location.href.indexOf("?")) ; return s ; } }window.QeryStringParser.prototype.getTypeName = function(){ return "QeryStringParser" ; } window.QeryStringParser.prototype.getParam = function(name){ if(typeof(this[name])=="undefined") return "" ; return this[name] ; } window.queryString = new QeryStringParser() ;调用的时候,加上上面的代码,要取参数,用 queryString.getParam("p") ; 就行了,可以接收多个参数。

大家还看了
也许喜欢
更多栏目

© 2021 3dmxku.com,All Rights Reserved.