PDA

View Full Version : should i use a cookie?


bajanstar
04-08-2004, 03:48 PM
i have a web page and its not online but i wanted to show the contents of 2 pages on one page. At first i decided to try to pass variables and the code looked like this:


<html><head>
<title> Receipt</title>
</head>

<body>

<h1>Receipt</h1>
<script type="text/javascript">
//<![CDATA[
function parseSearchString()
{
var pairs=unescape(location.search.substring(1).replace(/\+/g," ")).split('&');
for (var i=0;i<pairs.length;i++){
var pair = pairs[i].split('=');
this[pair[0]]=pair[1];
}
}
var search = new parseSearchString();

//this will output all the passed variables
<!--document.write("These are the variables passed:<br />");-->
for (o in search) document.write( search[o]+"<br />");
//]]>

</script>
</body></html>


but this only displays the variables from the previous page
:( so i was wondering if i could still use this(code above), if so how or should i just use a cookie code?