Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

BUG: SELECT Element Causes Application Error in Internet Explorer


View products that this article applies to.

This article was previously published under Q290717

↑ Back to the top


Symptoms

If the initial value of a SELECT element is set to null, and if the user selects an invalid option (if the chosen element does not contain an explicitly selected option, or if the chosen element does not point to an option that exists in the script), you may receive the following application error in Internet Explorer:
The instruction @ 0x70e45ed2 referenced at 0x00000022. The memory could not be read.

↑ Back to the top


Cause

This problem occurs because the chosen value does not exist in the list of valid options.

↑ Back to the top


Resolution

There are two ways to work around this problem:
  • Add a blank item at the beginning of the SELECT box. Check the value on submission. If the item is a blank item, notify the users that they must make a selection from the list.
  • Use the SELECTED attribute to leave a default value selected. For example:
    <OPTION VALUE="3" SELECTED>1</OPTION>
    					

↑ Back to the top


Status

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

↑ Back to the top


More information

Steps to Reproduce Behavior

  1. In any HTML editor, copy the following code, and save the file:
    <html>
    <head>
    <script LANGUAGE="JAVASCRIPT">
    
    function ClearValue() {
    	document.form1.select1.value = ""
    	document.form1.select1.focus()
    }
    </script>
    </head>
    
    <body LANGUAGE="javascript" onload="ClearValue()">
    
    <form Name="form1" METHOD="post">
    <select name="select1">
      <option value='1'>1</option>
      <option value='2'>2</option>
      <option value='3'>3</option>
    </select>
    </form>
    
    </body>
    </html>
    					
  2. Run the new Web page.
  3. With the select box clear, press any key except 1, 2 or 3. You receive the above-mentioned application error.

↑ Back to the top


References

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
237831� PRB: Problem Adding New Option to Select Box in Another Frame in Internet Explorer 5
239657� FIX: Removing Non-Visible Items from an HTML SELECT Box Causes General Protection Fault (GPF)
255610� PRB: CreateElement() for SELECT Options Is Slow in Internet Explorer 5
185123� PRB: SELECTED Attribute Not Honored After Refresh
265489� PRB: Approximately 200 or More SELECT Boxes in HTML Causes Slow and Unstable Performance in Windows 95 and Windows 98
For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:

↑ Back to the top


Keywords: KB290717, kbnofix, kbdhtml, kbbug

↑ Back to the top

Article Info
Article ID : 290717
Revision : 5
Created on : 5/11/2006
Published on : 5/11/2006
Exists online : False
Views : 464