Track Changes on a Form

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.


About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist