Pass infor between web pages in the same window

B

banyan

Hi,

I want to supply the previous page in current window with a string from
current page and the content in the previous one is changed
accordingly. I use <DIV> innerHTML to accomplish the DHTML and run
below JS in current page when deciding to go back.

window.history.go(-1);
document.getElementById('ObjA').innerHTML='my string';

But the "document" still refers to current page, even though I add a
document.clear() and location.replace() statements right after
window.history.go(-1).

I find the archieve of this Group mentions a few solutions for a
similar problem, however they don't seems to work for my scenario.

The first solutin is to append the string to the previous URL. But my
first page was actually loaded from a HTML file and there is no CGI
program to receive the string.

The second solution is to use cookie to pass the infor. It seems the
string is to saved in the "document" object though. Since the
"document" is not updated, I won't be better off. Another problem is
this solution requires cookie to be turned on in the browser.

The third one is to use frame, which is not desirable nowadays if I am
not wrong.

Any input is appreciated.

Thanks,
Zhigao
 
M

mike

if you were in your child document and wanted to access an element in
the parent doc you could use:

self.opener.addToForm('test');

this passes "test" to a function called addToForm that is in the parent
document.

self.opener.document.myform.elements['myelement'].value='test';

adds "test" to a element called "myelement" in the form called "myform"

Hope that helps some.
 
C

Chen Zhigao

Thanks for the reply. But I am afraid "window.opener" refers to the
main window of a pop-up window. What I am dealing with is, however, two
documents in one window.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top