PRB: SELECTED Attribute Not Honored After Refresh (185123)



The information in this article applies to:

  • Microsoft Internet Explorer (Programming) 4.0
  • Microsoft Internet Explorer (Programming) 4.01

This article was previously published under Q185123

SYMPTOMS

After a page is refreshed, the SELECTED attribute of the <OPTION> tag within a <SELECT></SELECT> is not honored. (See "Steps to Reproduce Behavior" section below).

The expected behavior is that Internet Explorer 3.02 and Netscape Navigator 4.0 change the <SELECT> boxes back to their default options when the page is refreshed.

CAUSE

Internet Explorer persists the state of the <SELECT> and the stored state is reloaded whenever Internet Explorer navigates through entries in the History list. This includes the back and forward arrows, the lists accessible from those arrows, the history list accessible from the Object Model, and yes, the Refresh button, which is equivalent to going to the most recent item in History.

Reopening the same URL causes the <SELECT> control to have the original state, as that action does not go through the history.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a Web page with the following content:
    <HTML>
    <HEAD></HEAD>
    <BODY>
       <SELECT SIZE="1" NAME="MyList">
          <OPTION VALUE="Zero">Zero
          <OPTION VALUE="One">One
          <OPTION VALUE="Two" SELECTED>Two
       </SELECT>
       <BR>
    </BODY>
    </HTML>
    						
  2. Navigate to the Web page that you just created. Select item "One" in the SELECT control.
  3. Refresh the page by pressing F5.
The SELECT control will have item "One" selected rather than item "Two," which is the default.

REFERENCES

For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:

Modification Type:MajorLast Reviewed:5/11/2006
Keywords:kbprb KB185123