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



The information in this article applies to:

  • Microsoft Internet Explorer (Programming) 5.5 SP2
  • Microsoft Internet Explorer (Programming) 6.0
  • Microsoft Internet Explorer (Programming) 6 (SP1)

SYMPTOMS

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

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.

STATUS

This behavior is by design.

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>

Modification Type:MajorLast Reviewed:11/17/2003
Keywords:kbDHTML kbprb KB812417 kbAudDeveloper