This can be done simply using query strings. The form you submit passes the results to the second page using the variable location.search, which can be read by the Javascript program. You can process form results like this:
Code:
<script>
<!--
var keyvals = location.search.substring(1).split("&");
var search = new Object();
for (var i = 0; i < keyvals.length; i++) {
var temp = keyvals[i].split("=");
temp[1] = temp[1].split("+").join(" "); // fix + sign bug
search[temp[0]] = unescape(temp[1]);
}
// -->
</script>
Now all results are in an object called search and if a text element on the first page is called "query" you can print it out like this:
Code:
You searched for
<script>
<!--
document.write(search.query);
// -->
</script>
[Edited by voicebox on 05-14-2001 at 09:00 AM]
Bookmarks