I have the following JavaScript code –
function addOnClickEventHandler()
{
var userNameElement = document.getElementById("currentUser");
var userName = userNameElement.value; // send this value to "chatWindow"
window.open("chatWindow.html", "Chat Window", "resizable=0,width=700,height=600");
}
Now, how do I send the value of userName to “chatWindow”? Also, how to access this value once it has been sent?
In the window being opened you can refer to the parent window as follows:
var oWinCaller = top.opener;
With this reference you can then get whatever you want from the opening window when the new window opens.