zelexir wrote:
> 
> 
> 
> zelexir wrote:
>> 
>> Hi there,
>> 
>> I'm trying to edit thickbox to call a default function whenever a
>> iframe has loaded, the function will not always exist in the page
>> loaded so I would not want a JS-error when this is the case.
>> Code I'm using atm:
>> 
>> .                  try       {
>> line 304:          setTimeout("frames['TB_iframeContent'].TB_loaded()",
>> 100);
>> .               }
>> .    catch (e){alert(e)}
>> 
>> the alert here is just for my debugging, and would be removed when I'm
>> finished with the testing.
>> 
>> Anyway, when the function exists it only gets properly executed once,
>> if for instance I have a login form that opens in a thickbox, and I
>> close it only to open it again, the second time I get this error:
>> 
>> frames.TB_iframeContent.TB_loaded is not a function
>> http://localhost/haddock/js/thickbox.js
>> Line 304
>> 
>> This is a but puzzling, thickbox RELOADS the content to be put in the
>> iframe right? Then why could it matter if it's the first or second
>> time it has been loaded?
>> 
>> Oh and anyone have a good way of checking if the function exists to
>> avoid any error messages when it doesnt?
>> 
>> Thx in advance guys
>> 
>> _______________________________________________
>> jQuery mailing list
>> [email protected]
>> http://jquery.com/discuss/
>> 
>> 
> 
> ATM, I'm only testing this with pages where the function exists. But I
> just noticed that this works as expected in IE7, it runs the function
> everytime, but in FF it only runs the first time.
> 

Ok now I've solved the error when the function is missing with this:
                        var func = frames['TB_iframeContent'].TB_loaded;
                        if (typeof(func)=="function")
                                setTimeout(func, 100);

I'm still puzzled about FF behavior though, anyone have an idea what the
problem might be?
-- 
View this message in context: 
http://www.nabble.com/Calling-a-%22default%22-function-in-a-IFrame-tf3127501.html#a8665739
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to