BUG: OnChange Event of <SELECT> Fires Incorrectly in a FRAME When Refreshed Programmatically

Article translations Article translations
Article ID: 319741 - View products that this article applies to.
This article was previously published under Q319741
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

On This Page


If you have a FRAMESET object with a FRAME that contains a SELECT control and an INPUT TYPE=TEXT or TEXTAREA control, and the OnChange event of the TEXTAREA control reloads the page, the OnChange event of the SELECT may fire after the page reloads. This behavior may occur even if you do not select a new item from the SELECT control.


This is a regression from Internet Explorer 5.5.


To work around this problem, you can use one of the following methods. The method you use depends on the usage of the elements in your application.
  • Disable the Select box before the page unloads.
  • If you must submit a form, check the document.readyState property in the OnChange event before you submit the form. You must check this value in the OnChange event before you submit the form because this bug may cause two submits to occur at the same time, one submit from the Select box and one submit from the text box.


Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.


The problem that is described in the "Symptoms" section of this article may also apply to other events of the SELECT element, such as the onbeforeactivate event. The problem occurs if an unload is triggered from an event of an object that fires when the event loses focus (OnChange event, onblur event).

Steps to Reproduce the Behavior

  1. Use the following code to create a FRAMESET:
    <TITLE>Test for Q319741</TITLE>
          <FRAME SRC="testFrame.html" NAME=MAIN>
  2. Save the file as Frameset.html.
  3. Create a new Hypertext Markup Language (HTML) file with the following code.
    function selectOnchange()
       // workaround 2
       // if (document.readyState == 'complete')
       alert('select is changed');
    function inputOnchange()
       // workaround 1
       // select1.disabled=true;
    <SELECT id=select1 onchange="selectOnchange();"> <!-- using onBeforeDeactivate will cause the problem too -->
       <OPTION value=-1>Select</OPTION>
       <OPTION value="option1">option1</OPTION>
       <OPTION value="option2">option2</OPTION>
       <OPTION value="option3">option3</OPTION>
    Please type text inside this textbox: <input type=text onchange="inputOnchange();"></input> <!-- using onBlur will cause the problem too -->
  4. Save the file as TestFrame.html.
  5. Place both .html files in the same directory.
  6. Locate the Frameset.html file.
  7. Click in the text box and type some text.
  8. Click the arrow on the SELECT box. This causes the OnChange event in the text box to fire.
After you click the SELECT control, a Window.alert MessageBox appears even though the currently-selected OPTION in the SELECT control does not change.


For more information, visit the following MSDN Web sites:
SELECT Element | select Object

onbeforedeactivate Event

onchange Event


Article ID: 319741 - Last Review: January 12, 2015 - Revision: 7.2
  • Microsoft Internet Explorer (Programming) 5.5 SP2
  • Microsoft Internet Explorer 6.0
kbnosurvey kbarchive kbbug kbpending KB319741

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com