JavaScript: access global variables between window and opener
A nice hint (for me, the novice) at this site.
One way to access global variables between window and opener is to
centralize the location of the global variables and access them
appropriately.
Example:
doc1:
var v1 = 1, v2 = 2;
var w = window.open('doc2.htm', 'doc2');
doc2:
To access v1 and v2 global variables, you have to reach doc1's window
appropriately, and in that case, from doc2:
alert(window.opener.window.v1);
0 Comments:
Posta un commento
<< Home