views:

1493

answers:

3

Hi friends,

Is it possible to get the value from first page to second page.. BUT with out FORM

Shall we use window.parent.document.getElementById("").value..

But this is working in popup window, but i need this for between two pages which redirecting from first page to second page.

+1  A: 

If you are redirecting from one page to another, you MUST use form elements to pass from page to page or use a querystring value. That is it, Javascript does NOT have any knowledge of the structure of the previous page..

Mitchel Sellers
+1  A: 

or you can use cookies...

Ionut Staicu
A: 

You could also simply use GET variables by calling site.com/index.php?info=value and escaping the contents of value. The URL can be changed dinamically, like so:

<input type="text" id="the_value" />
<a href="#" onclick="return updateURL()" id="the_link">Click me</a>
<script type="text/javascript">
function updateURL()
{
    document.getElementById('the_link').href =
        'site.com/index2.php?info=' +
        encodeURIComponent(document.getElementById('the_value'));
    return true;
}
</script>
Tom