For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > May 2004 > Onload Event Causing Error in ASP.NET Code









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Onload Event Causing Error in ASP.NET Code
Bryan

2004-05-30, 12:39 am

I have the following in my asp.net html page:

<script language="JavaScript" type=text/javascript>
Function loader(){
<% If Not Page.IsPostBack Then %>
document.form1.submit();
<% End If %>
}
</script><BODY onLoad="loader();" leftMargin="0" topMargin="0"><form id="form1" runat="server">

When I try to go to that page I get two error: 1) Microsoft Jscript runtime Error Object Expected at the <BODY onLoad="loader();" leftMargin="0" topMargin="0"> line
2) An Error: Expected ';' at the <script language="JavaScript" type=text/javascript> line

What's up? It seems like the code is right from all the internet examples I've seen.
Teemu Keiski

2004-05-30, 6:39 am

Hi,

"Function" should be "function" (it is all lowercase in JavaScript)

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke



"Bryan" <anonymous@discussions.microsoft.com> wrote in message
news:1DFD9D82-5435-4F90-A91E-52076AEEC736@microsoft.com...
> I have the following in my asp.net html page:
>
> <script language="JavaScript" type=text/javascript>
> Function loader(){
> <% If Not Page.IsPostBack Then %>
> document.form1.submit();
> <% End If %>
> }
> </script><BODY onLoad="loader();" leftMargin="0" topMargin="0"><form

id="form1" runat="server">
>
> When I try to go to that page I get two error: 1) Microsoft Jscript

runtime Error Object Expected at the <BODY onLoad="loader();" leftMargin="0"
topMargin="0"> line
> 2) An Error: Expected ';' at the <script language="JavaScript"

type=text/javascript> line
>
> What's up? It seems like the code is right from all the internet examples

I've seen.


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com