Categories:

Frames can actually help JavaScript too!

With JavaScript helping others all the time, its nice to know that someone gives it a hand once in a while too. Frames can be very helpful to JavaScript when creating JavaScript driven applications, and the reason requires a little explanation.

By default, all variables and functions created in JavaScript in one page is lost when you leave that particular page. For example, if I make a JavaScript declaration in this page:

var x=500

This x only exists in this page-as soon as you leave, x is erased, gone. This is great, in most cases, since if the browser retains every variable, not only will it overload your memory, but also, if two pages use the same variable, there will be a small riot starting in your browser. Having said that, in special cases, what if you want to retain that variable temporarily, even if a new page is loaded? Well, the key is by using frames. You can store all variables you want to retain for further processing in one frame that is not being changed,while the other frames can change all they want. Since that particular frame is not being loaded with new content, the variable is retained, until you leave that whole document, of course.