I have a parent window that is contains an iframe (containing a
calendar) that I want to work with. Both are in the same domain (and
folder) and both include jQuery.

When I click on a day (i.e. a table cell), I want to get the id (which
contains the date) to set the value of a text box in the parent form.
I can get it to work with Firefox, but not Internet Explorer.

Also, when the iframe page changes (i.e. I click a link within it),
the load event isn't fired again in IE (but is in Firefox).

This is what I have in the parent document:

$(
        function()
        {
                var shifts = $(frames["shifts"]||"#shifts");
                shifts.load(
                        function()
                        {
                                alert("iframe loaded"); // fires each time the 
iframe loads in
Firefox, but not IE
                                var d = this.contentDocument;
                                if(!d) d = this.document; // IE
                                else d = d.defaultView; // firefox
                                var days = d.$("td.shift");
                                days.each(
                                        function()
                                        {
                                                var self = $(this);
                                                var text = self.text();
                                                self.empty().append("<a 
href='#'>").find("a").append(text).click(
                                                        function()
                                                        {
                                                                alert("selected 
" + this.parentNode.id);
                                                                return false;
                                                        }
                                                );
                                        }
                                )
                        }
                );
        }
)


Perhaps in a future version of jQuery, it will do this transparently, i.e.
var myiframe = $("#myiframe");
myiframe.load(
        function()
        {
                var d = this.document;
                d.$("a").click(function(){return false});
        }
)

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to