Jump to content

open window object, then change pages. still same window?


Recommended Posts

Hi all,   I'm trying to wrap my head around the idea of the window object and the document object relationship.   I've read some really good explanations in stackoverflow and others.  I have a pretty good grasp of it so I tried an experiment.   If the window object opens in the browser, and then the document object opens in the window, then if I change the document, will the window object remain the same.  I tried make 2 simple html's - in the first I set a variable like  window.myVar = "myValue";.   I was able to change the value with a button so it was working fine, and then I used an <a> href to change to a different document.   I tried to reference the window.myVar but it came back 'undefined'.   If you change documents in a window, does the document always come with a new window, or am I doing something wrong here?   Like I said, I've read a lot about the window and document object, but I couldn't see that this was addressed.   Thank You for any response....

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...