Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Cross Browser Issues
Expertise: Beginner
Oct 18, 1999



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Track Changes on a Form

I have an HTML page that is broken up into two different frames. The left frame acts as a navigation tool. The right frame is the user interface, which consists of a form with different input types. I want to track when a field has changed so I can prompt users if they try to navigate away from this page using the left frame. I can track the changes by using an onchange event, but I can't seem to trap when they leave the page. I have tried the using the onblur for the page and the window, but I can't seem to get it right.


You can track when the person tries to navigator to another page, either at frame or window level, using the "onUnLoad" event handler. Use this code in the body tag for a page:

or within a frameset:

Note, though, that the onUnLoad event won't work with browsers that don't support Navigator JS 1.1 or higher. However, it should work with Navigator 3.x and up, and IE 4.x and up.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date