Small prob i’m using the following line of code
customerName = window.opener.form2.custName.value;
The problem is that I’m no longer opening the page in a new window, I’m opening it in the same window and thus replacing the older page.
Is there anyway for me to get the same information?
Pass it as a paratemer in the query string to the new page.
If you would open the new page as, say:
<a href="newPage.html">..., pass the details as
If you aren’t opening a new window, window.opener won’t be available.
You could try passing the value of custName on the query string e.g. http://example.com/somepage.htm?custName=
Otherwise, set a cookie and retrieve its value on the 2nd page.
You need to pass the value / values you want on to the new page in some way. Some pointers:
- Use a cookie to store the value in one page, then retrieve it in the next.
- Pass it on as a parameter in the URL, or by submitting a form to the new page.
- Store it in session, then retrieve it.
Of course, you may also wish to consider the nature of the data. If it is sensitive, you should use the session or form alternatives to ensure that info is not viewable from the outside (in a cookie, or in the browser’s URL, for instance).