views:

332

answers:

2

I am trying to reference a javascript function in a .js file loaded in my main page from an iframe using the 'top' variable. It works in FF, Safari, and IE6 but not in IE8.

The snippet is (assigned to onmouseover):

top.set_image(this, 'images/login_h.png')

Where set_image is my function.

The error is "Object does not support this function"

Also, I have been looking for the definition of top. I can't find it in the ECMAScript specification or the w3schools site and Google is unhelpful (who'da thunk top was a common word?).

A: 

In IE8 top is an object of type DispHTMLWindow2 (outermost window object). Already discussed in this question.

Li0liQ
A: 

The problem was not with top, but with using the the keyword "const" in the .js script where the functions are defined. The resulting syntax error made the functions undefined. There seems to be some inconsistencies in the error reporting, I'm pretty sure that the error message did not show up on at least one occasion.

Jim Rootham