Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

object expected error in IE only

 
Wendy Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this page runs fine in firefox but returns the horrible "object expected" error, and in the onload method it says
error 'imagePlaceholderNames ' is unexpected, what have i done wrong please.



i read on one website that IE could be doing things in the wrong order, but surely it does leave onload until the right time...
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
looks like your html markup got screwed up by the forum.

can you repaste it with the "Disable HTML in this message" checkbox checked.

Eric

 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also version of IE is?
 
Wendy Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IE 7, sorry forgot that bit, not sure it did, but here it is again (just in case)

 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was blind the first time I looked at it

for each (var imageName in orderedImageNamesArray){

JavaScript does not have a for each, it is just for

Eric

 
Henry Wong
author
Marshal
Pie
Posts: 21405
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric Pascarello wrote:JavaScript does not have a for each, it is just for


Actually, I think it does. It is just really new. I accidently used it myself too. And had to convert it to a for loop.

If I remember correctly, it was added to firefox at 1.5. And IE 7 definitely doesn't support it.

Henry
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My Opinion: If it is not in JavaScript 1.5 it is not in JavaScript.

I think it is in JavaScript 1.6, too lazy to check Mozilla's site


 
Wendy Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry to be dense but just double checking that means it only has c style for loops
for(i=0;i<x;i++){

}>
 
Henry Wong
author
Marshal
Pie
Posts: 21405
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Eric Pascarello wrote:My Opinion: If it is not in JavaScript 1.5 it is not in JavaScript.


Yeah. After I got burned with it, I marked that whole section in the book as "stuff to not use"... I didn't go as far as "it doesn't exist" though...


Wendy Gibbons wrote:sorry to be dense but just double checking that means it only has c style for loops


No. The "for ... in" loop works just fine in IE7. It is the "for each ... in" loop that is new, and is not supported in IE7.

Henry
 
Wendy Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:

No. The "for ... in" loop works just fine in IE7. It is the "for each ... in" loop that is new, and is not supported in IE7.

Henry


thanks glad i checked
 
Wendy Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks very much that worked,
i wondered what was diff about the foreach until i just tested it



produces the output 0,1,2,3
not image1,image2,image3,image4 as i was expecting
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The for..in construct is most useful when iterating over the properties of an object. For arrays, you should be using the good old normal for loop.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic