Knowledge Base

PRB: "Is Not An Object" Error When Submitting Incomplete Doc

Article ID: 190279

Article Last Modified on 3/3/2005


APPLIES TO


This article was previously published under Q190279

SYMPTOMS

When an HTML page with a form is dynamically created using document.write() and the page does not include fundamental HTML tags and is submitted, the following error occurs in Internet Explorer 4.01:
Error: <reference to the form> is not an object

CAUSE

Fundamental HTML tags should always be used in HTML pages. The lack of them can potentially cause a problem in various browsers or versions of browsers.

RESOLUTION

Adding <html>, <head>, <title>, and <body> tags to the dynamically created document prevents the error from occurring.

STATUS

Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Behavior

Place the following code in the onclick event of a button in one frame of a two-frame URL and name the other frame "frame2." When clicking the button, the error appears. The added lines to make it work are commented:
   parent.frame2.document.open() ;

   // added line
   parent.frame2.document.write('<HTML><HEAD><TITLE>a</TITLE>') ;
   parent.frame2.document.write('</HEAD><BODY>') ;

   parent.frame2.document.write('<form method="POST" name="list" ') ;
   parent.frame2.document.write('<action="feedback.exe">') ;

   parent.frame2.document.write('<input type="hidden" name="Name" ') ;
   parent.frame2.document.write('value="x">') ;

   parent.frame2.document.write('</form>') ;

   // added line
   parent.frame2.main.document.write('</BODY></HTML>') ;

   // error occurs here if the other commented lines are not included.
   parent.frame2.main.document.list.submit() ;
   parent.frame2.document.close() ;
				

REFERENCES

http://www.microsoft.com/msdn/sdk/inetsdk/help/default.htm

Additional query words: kbHTML kbScript kbIE

Keywords: kberrmsg kbscript kbprb KB190279