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
- Use the following code to create a FRAMESET:
<HTML>
<HEAD>
<TITLE>Test for Q319741</TITLE>
</HEAD>
<FRAMESET ROWS="*">
<FRAME SRC="testFrame.html" NAME=MAIN>
</FRAMESET>
</HTML>
- Save the file as Frameset.html.
- Create a new Hypertext Markup Language (HTML) file with the following code.
<HTML>
<HEAD></HEAD>
<SCRIPT>
function selectOnchange()
{
// workaround 2
// if (document.readyState == 'complete')
alert('select is changed');
}
function inputOnchange()
{
// workaround 1
// select1.disabled=true;
location.reload(true);
}
</SCRIPT>
<BODY>
<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>
</SELECT>
<BR><BR>
Please type text inside this textbox: <input type=text onchange="inputOnchange();"></input> <!-- using onBlur will cause the problem too -->
</BODY>
</HTML>
- Save the file as TestFrame.html.
- Place both .html files in the same directory.
- Locate the Frameset.html file.
- Click in the text box and type some text.
- 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.