aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes object expected error in IE only Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "object expected error in IE only" Watch "object expected error in IE only" New topic
Author

object expected error in IE only

Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

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

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
Also version of IE is?
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

IE 7, sorry forgot that bit, not sure it did, but here it is again (just in case)

Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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
Sheriff

Joined: Sep 28, 2004
Posts: 18896
    
  40

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


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Oct 21, 2008
Posts: 1107

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
Sheriff

Joined: Sep 28, 2004
Posts: 18896
    
  40


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

Joined: Oct 21, 2008
Posts: 1107

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

Joined: Oct 21, 2008
Posts: 1107

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

Joined: Jan 10, 2002
Posts: 61434
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: object expected error in IE only