Calling javascript from inline HTML Floatbox
Page: 1
Author | Post |
---|---|
#1 Mon Apr 29, 2013 9:51 pm
|
|
Member
Registered: Apr 2013
Posts: 22
Location: Nevada Test Site, USA
|
Using the inline DIV content, I'm getting an error "Function()" is null or undefined. The function is in a script file that is included on the page the hidden DIV is on. But when called from the DIV's content in Floatbox, I get the error. I've already discovered that I need to re-include the .js file when loading floatbox by AJAX or IFRAME. Do I have to do that for my inline DIVs too? Or am I missing something?
|
#2 Tue Apr 30, 2013 12:10 am
|
|
Administrator
Registered: Aug 2008
Posts: 3382
|
I'll need to see the page to determine why this is happening.
Content loaded from a hidden div or via AJAX is part of the host page's document and its script execution context is the host page's window object. Script and document references in such content work exactly the same from inside a floatbox as they do from the main page. Iframe content creates its own document and window object. Scripts and document references in iframe content operate within that child window object's space. To relate this to your case, if it is hidden div content in the floatbox, then the error arises from something other than the content being located within the floatbox at the time of execution. |
#3 Tue Apr 30, 2013 12:22 am
|
|
Member
Registered: Apr 2013
Posts: 22
Location: Nevada Test Site, USA
|
So sorry, my bad! I am porting someone else's code from an older lightbox clone to your vastly superior one and I wasn't aware of errors it already contained.
But just to clarify - so you are saying that if I use AJAX then it will still execute in the calling page's context? Here is the link I am using:
|
#4 Tue Apr 30, 2013 12:29 am
|
|
Administrator
Registered: Aug 2008
Posts: 3382
|
Correct about AJAX loading. type:ajax content is assigned to a div that resides on the main page, and not to an iframe element which would contain its own separate document and window object.
|
Page: 1