Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-08-2006, 08:25 PM   PM User | #1
vijay_83
New to the CF scene

 
Join Date: Sep 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
vijay_83 is an unknown quantity at this point
Object Required Error

Hi ,

I have used javascript coding in my Asp.Net application like this

<script language="javascript">
function Button1_Click()
{

//switch(Select1.selectedIndex)


//Case 0 // Use Automation.;
var sHTML;
sHTML =document.forms(0).children("dg1").outerhtml;
var oXL, oBook;
oXL = new ActiveXObject("Excel.Application");
//Set oXL = new ActiveXObject(".Application");
oBook = oXL.Workbooks.Add;
oBook.HTMLProject.HTMLProjectItems("Sheet1").Text = sHTML;
oBook.HTMLProject.RefreshDocument;
oXL.Visible = true;
oXL.UserControl = true;

//Case 1 // Use MIME Type (In a New Window).;
window.open("bottom.aspx?bExcel=1")

//Case 2 // Use MIME Type (In the Frame).;
//window.parent.frames("bottom").navigate "bottom.aspx?bExcel=1";

}

</script>

When i run it i get an error: "object required" in this particular line:
sHTML =document.forms(0).children("dg1").outerhtml;
Can anybody help me please?

Regards
Vijay
vijay_83 is offline   Reply With Quote
Old 12-08-2006, 09:36 PM   PM User | #2
A1ien51
Senior Coder

 
A1ien51's Avatar
 
Join Date: Jun 2002
Location: Between DC and Baltimore In a Cave
Posts: 2,717
Thanks: 1
Thanked 94 Times in 88 Posts
A1ien51 will become famous soon enough
() is a function/method
[] is an array/object

document.forms[0].elements["elementName"]

if you are using a ASP control the elementname is chnaged by the server.

Eric
__________________
Tech Author [Ajax In Action, JavaScript: Visual Blueprint]
A1ien51 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


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

Forum Jump


All times are GMT +1. The time now is 10:18 PM.


Advertisement
Log in to turn off these ads.