Calling Hype parent from internal javascript within that object

(Steve) #1

I’m trying to call a hype object with in itself. I’m not sure if it is possible… trying so many different ways and no luck… I have rigged up an example.

Trying to change backgroundColor within it’s on javasciprt… (18.2 KB)

(Greg) #2

This seems to work…

var mybackground = parent.document.getElementById('nameBox');

As opposed to this…

var mybackground = hypeDocument.getElementById('nameBox');

(Steve) #3

Thanks again!

(Mark Hunte) #4

Since you know the id of the parent box you can do as Greg suggests and use document to get the nameBox where hypeDocument will not find it but you do not need to get the parent, since you are asking the document to get the element named nameBox.