473,587 Members | 2,568 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error Object Expected

This one is driving me insane. The script works perfect on Firefox,
but Internet Explorer keeps complaining about "Error Object Expected"
and stuff like that. I've run it through Firefox's Java Console, and
it comes back with no errors. Any pointers on this, would be much
appreciated.

<script type="text/javascript">
<!--
var p = new Array(0,0,0,0,0 )
var c = new Array(0,0,0,0,0 ,0,0,0,0)

var classes = new Array(5)
classes[0] = "<a href='javascrip t:class(0)'>ASM 2O<\/a><div
id='c0'><\/div><a href='javascrip t:class(1)'>PPL 2O<\/a><div
id='c1'><\/div>"
classes[1] = "<a href='javascrip t:class(2)'>SNC 2D<\/a><div
id='c2'><\/div><a href='javascrip t:class(3)'>CHC 2D<\/a><div
id='c3'><\/div>"
classes[2] = "<a href='javascrip t:class(4)'>ENG 2D<\/a><div
id='c4'><\/div><a href='javascrip t:class(5)'>MPM 2D<\/a><div
id='c5'><\/div>"
classes[3] = "<a href='javascrip t:class(6)'>bre ak<\/a><div
id='c6'><\/div>"
classes[4] = "<a href='javascrip t:class(7)'>GLC 2O<\/a><div
id='c7'><\/div><a href='javascrip t:class(8)'>BBI 2O<\/a><div
id='c8'><\/div>"

var hom = new Array(8)
hom[0] = "<ul><li>Mo tion tweening<\/li><li>Shape
tweening<\/li><li>Splice<\/li><li>Motion guides<\/li><\/ul>"
hom[1] = "<ul><li>Stuff< \/li><\/ul>"
hom[2] = "<ul><li>Megatr ansect II<\/li><li>Workshee t<\/li><li>10.3
#1-14<\/li><\/ul>"
hom[3] = "<ul><li>Stuff< \/li><\/ul>"
hom[4] = "<ul><li>Re ad 2.1<\/li><li>Redo journal<\/li><\/ul>"
hom[5] = "<ul><li>Stuff< \/li><\/ul>"
hom[6] = "<ul><li>Yo u think you can get homework from a lunch
period?<\/li><\/ul>"
hom[7] = "<ul><li>Techno logy careers presentation<\/li><\/ul>"
hom[8] = "<ul><li>Stuff< \/li><\/ul>"

function display(period) {
if(p[period]==0){
document.getEle mentById("p"+pe riod).innerHTML =classes[period]
p[period]=1
}
else{
document.getEle mentById("p"+pe riod).innerHTML =""
p[period]=0
}
}

function class(num){
if(c[num]==0){
document.getEle mentById("c"+nu m).innerHTML=ho m[num]
c[num]=1
}
else{
document.getEle mentById("c"+nu m).innerHTML=""
c[num]=0
}
}
//-->
</script>
----------------------------------------------------------------------------
You can see the script in context here:
http://www.freewebs.com/cisbase/Mich.../homework.html

The gist of it, is that a link is clicked which calls display(period) .
This will then display the appropriate element from classes[] which in
turn provides a link that calls class(num) and displays the
corresponding element from hom[]

Again, works nice on Firefox.

Internet Explorer:
Upon loading, it gives this error:
Line: 42
Char: 10
Error: Expected '('
Code: 0

And when clicking one of the links it gives this error
Line: 1
Char: 1
Error: Object Expected
Code: 0

Nov 23 '05 #1
11 44223
VK

we*********@gma il.com wrote:
This one is driving me insane. The script works perfect on Firefox,
but Internet Explorer keeps complaining about "Error Object Expected"
and stuff like that. I've run it through Firefox's Java Console, and
it comes back with no errors. Any pointers on this, would be much
appreciated.


"class" is a reserved word in JScript, you cannot use it as identifier.

Keep this table near of your comp:
<http://msdn.microsoft. com/library/default.asp?url =/library/en-us/script56/html/js56jsconreserv ed.asp>

Nov 23 '05 #2
> "class" is a reserved word in JScript, you cannot use it as identifier.

Gah, I should have known that, thanks for the quick response.

Nov 23 '05 #3
>The script works perfect on Firefox,
but Internet Explorer keeps complaining about "Error Object Expected"
and stuff like that. I've run it through Firefox's Java Console, and
it comes back with no errors.


Another case where I've experienced EXACTLY the same behavior is when
I've left off "var" on a variable creation/assignment, and the variable
is being assigned an object. IE doesn't like that, but Firefox seems to
accept it. In these cases, putting in "var" inevitably fixes the
problem.

Not exactly your specific case, it seems, but it is another case where
the same error pops up.

Nov 23 '05 #4
VK wrote:
we*********@gma il.com wrote:
This one is driving me insane. The script works perfect on Firefox,
but Internet Explorer keeps complaining about "Error Object Expected"
and stuff like that. I've run it through Firefox's Java Console, and
it comes back with no errors. Any pointers on this, would be much
appreciated .

"class" is a reserved word in JScript, you cannot use it as identifier.

Keep this table near of your comp:
<http://msdn.microsoft. com/library/default.asp?url =/library/en-us/script56/html/js56jsconreserv ed.asp>


Probably worth pointing out that the Netscape proposal for JavaScript
2.0 includes classes, so the keyword 'class' will, if the proposal is
adopted, actually have some meaning.

<URL:http://www.mozilla.org/js/language/js20/core/classes.html>

--
Rob
Nov 23 '05 #5
VK

RobG wrote:
Probably worth pointing out that the Netscape proposal for JavaScript
2.0 includes classes, so the keyword 'class' will, if the proposal is
adopted, actually have some meaning.

<URL:http://www.mozilla.org/js/language/js20/core/classes.html>


Hi, RobG
I hope I'm not yet in your kill-file
:-(

"class" already has perfect meanning in JScript.Net - I'm just enjoying
it and waiting the "Empire strikes back" from Mozilla.

Actually it always puzzled me:

/* This is Java */
/* This is the class: */
class myObject {
int foo;
String bar;

/* This is the class constructor: */
public void myObject(String str) {
this.foo = 1;
this.bar = str;
}

/* This is the private member: */
private String methodOne() {
return this.bar
}

/* This is the public member: */
public String methodTwo() {
return methodOne();
}
}

..
..
..

/* This is JavaScript */

/* This is uhm... just constructor
but is has prototype which is *not* a class */
function myObject(str) {
this.foo = 1;
this.bar = str;

/* This is the public member: */
this.methodTwo = function() {return methodOne();}

/* This is the private member: */
function methodOne() {
return this.bar
}
}

Whoever doesn't see a global difference between JavaScript prototype
and Java class (lesser strict typed vs. loose typed issues) is a
complete idiot.

OK, I am one. (what a news anyway!)

Nov 23 '05 #6
VK wrote:
RobG wrote:
Probably worth pointing out that the Netscape proposal for JavaScript
2.0 includes classes, so the keyword 'class' will, if the proposal is
adopted, actually have some meaning.

<URL:http://www.mozilla.org/js/language/js20/core/classes.html>

Hi, RobG
I hope I'm not yet in your kill-file
:-(


Then my response will expose you to those that haven't done so to me
(yet) ;-p


"class" already has perfect meanning in JScript.Net - I'm just enjoying
it and waiting the "Empire strikes back" from Mozilla.
Mozilla.org is committed to open standards, the owners of JScript.NET
are not, hence the 'zilla guys have gone about it differently.

Having said that, if the Mozilla developers want to do their own thing
there is nothing to stop them - they have plenty of 'proprietary'
extensions in the Geko DOM - but extending JavaScript itself with
classes is a pretty fundamental shift and quite a different thing.

If classes are introduced in JavaScript 2.0/ECMAScrpipt Edition 4, it
will be interesting to see what happens with JScript.NET classes - how
compatible are they with Waldemar Horwat's proposal?
[...] /* This is JavaScript */

/* This is uhm... just constructor
but is has prototype which is *not* a class */
function myObject(str) {
this.foo = 1;
this.bar = str;

/* This is the public member: */
this.methodTwo = function() {return methodOne();}
It could also be called a privileged member since it has access to the
private member methodOne() - if my understanding of the terminology is
correct.


/* This is the private member: */
function methodOne() {
return this.bar
}
}

Whoever doesn't see a global difference between JavaScript prototype
and Java class (lesser strict typed vs. loose typed issues) is a
complete idiot.


I'm not qualified to comment.

Mistakes were made with JavaScript, Brendan Eich acknowledges that - he
wrote the original prototype in about one week. Fixing those mistakes
will be painful (if attempted) - are the benefits worth it?

Once a language is as widely adopted as JavaScript, it is very hard to
change it - backward compatibility rears its ugly head. It is very
important to get it right first time (though that will not always happen).

Let's not loose sight of the original intention of JavaScript (Mocha) to
be a simple language that is easy for anyone to implement. Brendan Eich
has a presentation that includes 'JavaScript in two slides'[1], complex
stuff was supposed to be done with Java. Perhaps the lethargy with
which JavaScript is moving toward it's next version is an indicator that
most are happy with it just as it is.

If ECMAScript Edition 4 is not adopted as a standard soon, will Mozilla
go it alone and hope the other open source folk follow/help out?
1. <URL:http://www.mozilla.org/js/language/ICFP-Keynote.ppt>
--
Rob
Nov 23 '05 #7
RobG wrote:
VK wrote:
RobG wrote:
Probably worth pointing out that the Netscape proposal for JavaScript
2.0 includes classes, so the keyword 'class' will, if the proposal is
adopted, actually have some meaning.
"class" already has perfect meanning in JScript.Net - I'm just enjoying
it and waiting the "Empire strikes back" from Mozilla.


Mozilla.org is committed to open standards, the owners of JScript.NET
are not, hence the 'zilla guys have gone about it differently.


However, JScript 7.0 (.NET) claims to be compliant to ECMAScript 4 in parts.

<http://msdn.microsoft. com/library/en-us/jscript7/html/jsgrpecmafeatur es.asp>
Having said that, if the Mozilla developers want to do their own thing
there is nothing to stop them - they have plenty of 'proprietary'
extensions in the Geko DOM
It is the other way around. The Gecko DOM (as any DOM) is proprietary
by design (and history), however it implements interfaces of the W3C DOM.
- but extending JavaScript itself with
classes is a pretty fundamental shift and quite a different thing.

If classes are introduced in JavaScript 2.0/ECMAScrpipt Edition 4,
What do you mean -- if? They are already introduced, there is even a test
implementation for ECMAScript 4 called Epimetheus. What is needed now is
a decent specification out of the proposal and a real implementation in a
browser. Hopefully in Mozilla/5.0 rv:1.8 or rv:2.0.
it will be interesting to see what happens with JScript.NET classes
- how compatible are they with Waldemar Horwat's proposal?
Quite, regarding the new language features.
[...]
/* This is JavaScript */

/* This is uhm... just constructor
but is has prototype which is *not* a class */
function myObject(str) {
this.foo = 1;
this.bar = str;

/* This is the public member: */
this.methodTwo = function() {return methodOne();}
It could also be called a privileged member since it has access to the
private member methodOne() - if my understanding of the terminology is
correct.


You're right. However, the syntax used by VK is (surprise!) not
ECMAScript compliant. FunctionStateme nts must not occur within
FunctionStateme nts; instead, FunctionExpress ions must be used.
Perhaps this is going to change in ECMAScript 4 as the proposal
says so:

| FunctionDefinit ion => function FunctionName FunctionCommon
| ...
| FunctionCommon => ( Parameters ) Result Block
| ...
| Block => { Directives }
| Directives =>
| «empty»
| | DirectivesPrefi x Directive^abbre v
| DirectivesPrefi x =>
| «empty»
| | DirectivesPrefi x Directive^full
| Directive^? =>
| ...
| | AnnotatableDire ctive^?
| ...
| AnnotatableDire ctive^? =>
| ...
| | FunctionDefinit ion
| ...
If ECMAScript Edition 4 is not adopted as a standard soon,
Wait a minute. It is currently still a Netscape proposal, it rather
looks to me like a working draft. It was maintained by waldemar who
also contributed to ECMAScript 3, however the I don't know if he is
still working for Netscape. Since the AOHell/TW takeover of Netscape,
all Netscape-related stuff somehow fall asleep, including ECMAScript 4.
will Mozilla go it alone and hope the other open source folk follow/help
out?
I doubt that. I liked to think someone from the inner core would check
ECMAScript 4 and propose it to ECMA as the Mozilla Foundation is a member.
Apparently, according to Brendan, that has happened now (September 26-28,
2005), which I was relieved to read. Standardization takes time, so we
should give them the time. Rushing it now will only result in the same
old errors again.
1. <URL:http://www.mozilla.org/js/language/ICFP-Keynote.ppt>


IMHO a shame to be found in this format at mozilla.org. Have they become so
Microsoftish there over the last months? First document.all and now this.
I have OpenOffice that supports PPT, but still ... :-(
PointedEars
Nov 23 '05 #8
Thomas 'PointedEars' Lahn wrote:
RobG wrote:
[...]
- but extending JavaScript itself with
classes is a pretty fundamental shift and quite a different thing.

If classes are introduced in JavaScript 2.0/ECMAScrpipt Edition 4,

What do you mean -- if?


I meant *with* JavaScript 2.0/ECMAScript Edition 4.

That is, when they start to become widely in web page scripts and
classes start being used. From what you have said regarding the Mozilla
browser, JavaScript 2.0 is very nearly here.

I presume that means other Geko-based browsers will adopt it too, other
open source browsers will surely not be far behind.
[...]
You're right. However, the syntax used by VK is (surprise!) not
ECMAScript compliant. FunctionStateme nts must not occur within
FunctionStateme nts; instead, FunctionExpress ions must be used.
The subtleties of the lingo sometimes completely evade me ... I had to
use the Mozilla documentation to sort that out. A function statement is:

function [name] ([parm1, parm2, ...]) {statements};
and a function expression is:

var x = function [name] ([parm1, parm2, ...]) {statements};
<URL:http://developer.mozil la.org/en/docs/Core_JavaScript _1.5_Reference: Functions#The_f unction_declara tion_.28functio n_statement.29>
Incidentally, the new-look documentation in Wiki format is great! (hint
to FAQ administrators/maintainers!!).
[...]
If ECMAScript Edition 4 is not adopted as a standard soon,

Wait a minute. It is currently still a Netscape proposal, it rather
looks to me like a working draft. It was maintained by waldemar who
also contributed to ECMAScript 3, however the I don't know if he is
still working for Netscape. Since the AOHell/TW takeover of Netscape,
all Netscape-related stuff somehow fall asleep, including ECMAScript 4.


'Soon' is relative. It's been what, 4 years in the making already? The
"Netscape" proposal started 5 years ago, hasn't changed in over 2 years
(if the change history is correct[1])... given JavaScript went from
nothing to 1.5 in a little over 3 years, gimme back the browser wars!! ;-p

That really is just a joke, but episodes (sagas?) such at that are
amazing drivers of innovation and invention.
will Mozilla go it alone and hope the other open source folk follow/help
out?

I doubt that. I liked to think someone from the inner core would check
ECMAScript 4 and propose it to ECMA as the Mozilla Foundation is a member.
Apparently, according to Brendan, that has happened now (September 26-28,
2005), which I was relieved to read. Standardization takes time, so we
should give them the time. Rushing it now will only result in the same
old errors again.


You at least seem hopeful that JS 2.0 will see the light of day, maybe
sometime in 2006?
[...]
1. <URL:http://www.mozilla.org/js/language/es4/index.html>
--
Rob
Nov 23 '05 #9
RobG wrote:
Thomas 'PointedEars' Lahn wrote:

<snip>
... . FunctionStateme nts must not occur within
FunctionStateme nts; instead, FunctionExpress ions
must be used.


The subtleties of the lingo sometimes completely evade
me ... I had to use the Mozilla documentation to sort
that out. A function statement is:

function [name] ([parm1, parm2, ...]) {statements};

and a function expression is:

var x = function [name] ([parm1, parm2, ...]) {statements};

<snip>

The strange part of this is that there is no FunctionStateme nt in ECMA
262 3rd edition.

<quote cite="ECMA 262 3rd edition: Section 13">
13 Function Definition

Syntax

FunctionDeclara tion :
function Identifier ( FormalParameter Listopt ) { FunctionBody }

FunctionExpress ion :
function Identifieropt ( FormalParameter Listopt ) { FunctionBody }

FormalParameter List :
Identifier
FormalParameter List , Identifier

FunctionBody :
SourceElements
</quote>

In which the contents of a function (expression or declaration) are
SourceElements, defined as:-
<quote cite="ECMA 262 3rd edition: section 14">
14 Program

Syntax

Program :
SourceElements

SourceElements :
SourceElement
SourceElements SourceElement

SourceElement :
Statement
FunctionDeclara tion
</quote>

Where SourceElements are defined as any number of Statements and
FunctionDeclara tions, so all functions (expressions or declarations),
may contain FunctionDeclara tions.

Richard.
Nov 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
5703
by: Enos Meroka | last post by:
Hallo, I am a student doing my project in the university.. I have been trying to compile the program using HP -UX aCC compiler, however I keep on getting the following errors. ================================================================= Error 19: "CORBAManagerMessages.h", line 4 # Unexpected 'std'. using std::string; ^^^
1
10303
by: Franko | last post by:
I get the following error. Please help c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(6,38): error CS1001: Identifier expected c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(6,52): error CS1002: ; expected c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(7,19): error CS1519: Invalid token '(' in class, struct, or interface member...
1
2278
by: Franko | last post by:
I get the following error. Please help c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(6,38): error CS1001: Identifier expected c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(6,52): error CS1002: ; expected c:\inetpub\wwwroot\WebApplication1\WebForm2.aspx(7,19): error CS1519: Invalid token '(' in class, struct, or interface member...
0
23470
by: HKSHK | last post by:
This list compares the error codes used in VB.NET 2003 with those used in VB6. Error Codes: ============ 3: This Error number is obsolete and no longer used. (Formerly: Return without GoSub) 5: Procedure call or argument is not valid. 6: Overflow. 7: Out of memory.
1
3894
by: JOJO123 | last post by:
I got here in search of an answer to this Javascrpt question. I upgraded jave on XP Ie 7, acrobat 5.1 and suddenly can't open any pdf files on web sites using IE. I see u guys all say, this is a Javscript issue. but how do we, mere mortals who know nothing of anything about Java, scripts, etc, fix this? Is there a programm, does MS have any fix?...
6
5315
by: Lawrence Spector | last post by:
I ran into a problem using g++. Visual Studio 2005 never complained about this, but with g++ I ran into this error. I can't figure out if I've done something wrong or if this is a compiler bug. Here's a very simple example which should illustrate what I'm doing. #include <iostream> template <class T> class TestBase {
1
2802
by: BSand0764 | last post by:
I'm getting an error that I can't seem to resolve. When I compile the Functor related logic in a test program, the files compile and execute properly (see Listing #1). However, when I incorporate the same logic within my simulation, the class that implements the functor logic has problems compiling. I get the following errors: --...
2
5718
by: thj | last post by:
Hi. I've got this form that I'm trying to validate: <form id="periodForm" action="" method="post"> <p> Periode: <input id="startDate" name="startDate" type="text" size="7" value="<%= ViewData %>" /> -
2
2453
by: vijayrvs | last post by:
SearchCrawler.java The program search crawler used to search the files from the website. From the following program i got 7 compiler error. can any body clarify it and provide me solution. import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; import java.util.*;
0
8206
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7967
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6621
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5713
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3840
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3875
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.