Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error: "document is null or not an object"??? 1

Status
Not open for further replies.

Goalie3533

Programmer
Apr 14, 2004
53
US
I have a strange javascript error on one of my company's intranet pages.

The error reads "window.document.viewreport.close is null or not an object".

The strange part about this is that only one computer in the office out of the 10 I've tried to duplicate the error on so far brings up the error. The rest work fine.
So based on that info, I'm venturing a guess that he may not have the latest ms service pack or internet explorer and if he were to update his machine, everything would be fine however, I'd prefer to fix this code rather than have people go through the process of updating their computers if I can avoid it.

He's getting an error with the following portion of code(btw, while the error appears to be a javascript issue, the page is written in asp.net):
----------------------------------------------------------
<body onfocus="window.document.ViewReport.Close.focus()" bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0" runat="server">
--------------------------------------------------------

The onfocus is trying to reference a link button on the page that closes the page. Here's that portion of the code:
------------------------------------------------------
<asp:HyperLink id="Close" NavigateUrl="javascript:window.close();" runat="server" CssClass="SubHead">
------------------------------------------------------

Any idea what may be causing this error or should I just tell him to update his machine?

Thanks in advance.

-Goalie35
 
window.document.viewreport.close is looking for a form element. To access the link, use document.getElementById('Close').focus() instead.

Also, is it standard to use a runat="server" in a body tag?

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top