From 099b11ff3a8af3c87c02bd211e2c233ae2e6e491 Mon Sep 17 00:00:00 2001 From: "Anders S. Mortensen" Date: Thu, 28 Dec 2006 11:02:48 +0000 Subject: [PATCH] Added rudimentary back-button functionality. --- www/test1/index.html | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/www/test1/index.html b/www/test1/index.html index 1635922..4f786bd 100644 --- a/www/test1/index.html +++ b/www/test1/index.html @@ -306,10 +306,61 @@ function start_search() xsearch.send(null); document.getElementById("termlist").innerHTML = ''; document.getElementById("body").innerHTML = ''; + update_history(); shown = 0; startrec = 0; } + +function session_encode () +{ + var session_cells = Array('query'); + var i; + var session = ''; + + for (i = 0; i < session_cells.length; i++) + { + var name = session_cells[i]; + var value = escape(document.getElementById(name).value); + session += '&' + name + '=' + value; + } + + return session; +} + + +function session_decode (session) +{ + +} + + +function session_read () +{ + var ses = document.location.href; + return ses.replace(/.*#/, ''); +} + + +function session_store (new_value) +{ + var location = document.location.href; + + location = location.replace(/#.*$/, ''); + location += '#' + new_value; + document.location.href = location; +} + + +function update_history () { + var session = session_encode(); + session_store(session); +} + + + + + -- 1.7.10.4