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.

PRB: outerHTML Property of HTML Element Does Not Display the Default Attribute


View products that this article applies to.

Symptoms

Microsoft Internet Explorer may remove the type property when it returns the outerHTML property for either of the following HTML elements:
  • INPUT
  • BUTTON

↑ Back to the top


Cause

By default, the type property of an INPUT element is text. By default, the type property of a BUTTON element is button. Internet Explorer can detect the default property of an HTML element after it detects the type of the element. Internet Explorer omits the default property when the outerHTML property of the element is retrieved, so outerHTML does not display the default property.

↑ Back to the top


Status

This behavior is by design.

↑ Back to the top


More information

To reproduce the behavior, paste the following code in an HTML file, and then open it in Internet Explorer:
<HTML>
<HEAD
<SCRIPT language="jscript">

function grabText()
{	
	var txtHTML = document.all("Text1").outerHTML;
	var btnHTML = document.all("Button1").outerHTML;
	
	alert("The outerHTML of the textbox is: \t" + txtHTML 
			+ "\n\nThe outerHTML of the button is: \t" + btnHTML);
}	
 
</SCRIPT>
</HEAD>

<BODY onload="grabText();">
	<INPUT type="text" ID="Text1" NAME="Text1" value="Text"><BR>
	<BUTTON type="Button" ID="Button1" NAME="Button1">Button</BUTTON>
</BODY>
</HTML>

↑ Back to the top


Properties

↑ Back to the top


Article Info
Article ID : 812417
Revision : 2
Created on : 1/1/0001
Published on : 1/1/0001
Exists online : False
Views : 336