Jun 3, 2001 #1 rosesau Programmer May 24, 2001 9 AU Hi, i need information on how to use a variable from one web page on another web page thanks rose
Jun 4, 2001 #2 jaredn Programmer Sep 1, 1999 1,506 US for strings and numbers, you can use my querystring object. to pass the variable, make your link look like: <a href="mypage.htm?name=benluc&age=15"> then on the page to receive the variable, include this object: function QSHandler() { var i,j,tmparray,strata,prlen strata = window.location.search strata = strata.substring(1,strata.length) if(strata.indexOf('&')>=0) { prsarray = strata.split('&') prlen = prsarray.length tmparray = new Array() for(t=j=0;j<prlen;j++) { tmparray[t++] = prsarray[j].split('=')[0] tmparray[t++] = prsarray[j].split('=')[1] } } else { tmparray = new Array(strata.split('=')[0],strata.split('=')[1]) } tlen = tmparray.length this.data = new Array() for(i=0;i<tlen;i++) { this.data[new String(tmparray)]=tmparray[++i] } this.QueryString=function(x) { return this.data[x] } } Request = new QSHandler() and reference it like so: Request.QueryString("name" otherwise, use a hidden frame that you don't change, and store the variable there, then access it with the second page jared@eae.net - http://webfx.eae.net Upvote 0 Downvote
for strings and numbers, you can use my querystring object. to pass the variable, make your link look like: <a href="mypage.htm?name=benluc&age=15"> then on the page to receive the variable, include this object: function QSHandler() { var i,j,tmparray,strata,prlen strata = window.location.search strata = strata.substring(1,strata.length) if(strata.indexOf('&')>=0) { prsarray = strata.split('&') prlen = prsarray.length tmparray = new Array() for(t=j=0;j<prlen;j++) { tmparray[t++] = prsarray[j].split('=')[0] tmparray[t++] = prsarray[j].split('=')[1] } } else { tmparray = new Array(strata.split('=')[0],strata.split('=')[1]) } tlen = tmparray.length this.data = new Array() for(i=0;i<tlen;i++) { this.data[new String(tmparray)]=tmparray[++i] } this.QueryString=function(x) { return this.data[x] } } Request = new QSHandler() and reference it like so: Request.QueryString("name" otherwise, use a hidden frame that you don't change, and store the variable there, then access it with the second page jared@eae.net - http://webfx.eae.net
Jun 4, 2001 #3 baad Programmer Apr 10, 2001 1,481 RU hi u can also use window.name (if u're openin new window) (smth like var x=window.open('page.html','wnd_param=value...' ,'height=300 width=300');) & then do just like jaredn says (split & other stuff) Upvote 0 Downvote
hi u can also use window.name (if u're openin new window) (smth like var x=window.open('page.html','wnd_param=value...' ,'height=300 width=300');) & then do just like jaredn says (split & other stuff)