PC Review


Reply
Thread Tools Rate Thread

document object is undefined after downloading a page

 
 
=?Utf-8?B?UGF0?=
Guest
Posts: n/a
 
      30th Sep 2004
We are experiencing a problem when a page is inside an iframe.

We have links to download certain files which are actually served by an asp
page. However, once the user clicks on the link and downloads the
attachment, any references to document object on the page's javascript code
results in object undefined error. Basically we have a button which calls a
javascript function and inside the function document object is referred to.
IE reports an error at this location. This page works fine if the page is
the top window.

Here is the code for the main page and also the as page served for the
iframe...
Outer HTML page

HTMLTest.htm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<meta http-equiv="Expires" content="0">
</head>
<body>
<P>This just place holder. click the button inside the iframe.</P>
<iframe src="test.asp"></iframe>
</body>
</html>


Asp page for the iframe ..

Test.asp

<%@ Language=VBScript %>

<%

if Request.Form("buttonSubmit") <> "" then

Dim fileName
Dim str1
Dim str2

fileName = "DynamicText.txt"
'These are the strings that are used to build the text file.
str1 = "<-- Hello -->"
str2 = "This is a demo on creating dynamic text file"

'ContentType specifies the MIME type of this header.
Response.ContentType = "text/plain"
'The AddHeader method adds an HTML header with a specified value.
'Content-disposition forces the browser to download.
Response.AddHeader "content-disposition", "attachment; filename=""" &
fileName & """"
Response.Write str1 & vbnewline
Response.Write str2
Response.End

End if

%>

<HTML>
<HEAD>
<TITLE> Demo on Creating Dynamic Text File </TITLE>
</HEAD>

<BODY>
<h4> This is a demo on creating a dynamic text file </h4>

<FORM action="" method=POST id=form1 name=form1>
<INPUT type="submit" value="Download TextFile" id=buttonSubmit
name=buttonSubmit>
<br />
<span style="background-color:blue;cursor:default;"
onclick="javascript:showAlert();">Click here after downloading.</span>
</FORM>

<script language="javascript" type="text/javascript">
function showAlert()
{
var str = document.body.innerHTML;
window.alert("If you see this message there is no problem.");
}
</script>
</BODY>
</HTML>

seems to be an IE bug, is there a way around it??

thanks
Pat Malay
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Word Document object in Excel show only 1 page =?Utf-8?B?Q2F0byBMYXJzZW4=?= Microsoft Excel Misc 3 11th Jul 2007 04:42 PM
<Object> Is undefined Sam Samnah Microsoft ASP .NET 2 13th Jun 2005 03:51 PM
'undefined' is null or not an object =?Utf-8?B?UGhpbA==?= Microsoft Outlook Discussion 2 13th Jun 2005 08:00 AM
'undefined' is null or not an object =?Utf-8?B?UGhpbA==?= Microsoft Frontpage 2 12th Jun 2005 07:25 AM
OLE object only displays first page of Word Document Bob Collins Microsoft Access External Data 0 2nd Jul 2003 10:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:01 PM.