Matt, I tried to use
1.   $("<div>bbbb</div>").appendTo($(window.document.blahblah));
and
2.   $("<div>bbbb</div>").appendTo($('#divId', window.document));
and
3.  var added = window.document.getElementById('divId');
     S('<div>HAHAHAHAHAH test</div>').appendTo(added);

The 2nd and 3rd method still works in Safari but not in IE.
I am not sure whether I implemented the first method as you described
correctly or not.

Thanks again.

On Aug 12, 11:20 pm, "Matt Stith" <[EMAIL PROTECTED]> wrote:
> Hmm.. try:
>
> $("<div>bbbb</div>").appendTo($(document.blahblah));
>
> On 8/13/07, Jay W <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > yeah, I did remove it. Here is the code, I changed the second line
> > inside the function according to your instruction. Works perfectly in
> > Safari, but got an "invalid argument" error in IE.
>
> > top.addDiv = function (window) {
> >       var doc = window.document;
> >       S('<div>HAHAHAHAHAH test</div>').appendTo(doc.body);
> >       S('#show', doc).toggle();
> > }
>
> > Thanks so much for your help.
>
> > On Aug 12, 11:04 pm, "Matt Stith" <[EMAIL PROTECTED]> wrote:
> > > Did you remove the 2nd argument to appendTo? that function only takes 1
> > > argument. Using the context when creating an element is useless too, so
> > > might as well remove the 2nd argument to $
>
> > > On 8/12/07, Jay W <[EMAIL PROTECTED]> wrote:
>
> > > > Well, Matt, it is only working in Safari, (maybe firefox), not in IE.
> > > > it will get "Invalid Argument" error message.  Is createElement in IE
> > > > limited only to that document?
>
> > > > On Aug 12, 10:41 pm, Jay W <[EMAIL PROTECTED]> wrote:
> > > > > Awesome, I just test it and it worked!!, I need to change
> > > > > window.document to window.document.body in the appendTo statement.
>
> > > > > Thank you so much. You have solved my big problem now. :) I give you
> > 5
> > > > > stars!
>
> > > > > On Aug 12, 5:01 pm, "Matt Stith" <[EMAIL PROTECTED]> wrote:
>
> > > > > > You dont need to specify the context when creating new elements,
> > and
> > > > > > appendTo takes 1 argument, try like this:
>
> > > > > > $('<div>text</div>').appendTo(window.document);
>
> > > > > > untested, but that should work
>
> > > > > > On 8/12/07, Jay W <[EMAIL PROTECTED]> wrote:
>
> > > > > > > Thanks. I tried it using $('<div>new div text here</div>',
> > > > > > > window.document).appendTo('body'), nothing happened; If I try $
> > > > > > > ('<div>new div text here</div>', window.document
> > ).appendTo('body',
> > > > > > > window.document), an "Invalid Argument" error is thrown.
>
> > > > > > > Any suggestion?
>
> > > > > > > Thanks
>
> > > > > > > On Aug 12, 11:43 am, "Matt Stith" <[EMAIL PROTECTED]> wrote:
> > > > > > > > You need to add the element to the document via .appendTo,
> > > > .prependTo,
> > > > > > > or
> > > > > > > > one of those similar methods. It isnt added to the DOM just by
> > > > creating
> > > > > > > it.
>
> > > > > > > > On 8/12/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > > I can use $('#id', window.document) to get an existing
> > element
> > > > from a
> > > > > > > > > document in a frame.
> > > > > > > > > However,  I also try to use $(html) to create a new DIV in
> > any
> > > > frame
> > > > > > > > > through function on top window and used the format
> > "$('<div>new
> > > > div
> > > > > > > > > text here</div>', window.document)", but it doesn't
> > work.  Is it
> > > > > > > > > possible to do this?
>
> > > > > > > > > Thanks.
>
> > > > > > > > > <html>
> > > > > > > > > <head>
> > > > > > > > > <script src='jquery.js'></script>
> > > > > > > > > <script src='jQuery.frameReady.js'></script>
>
> > > > > > > > > </head>
> > > > > > > > > <script>
>
> > > > > > > > > top.addDiv = function (window) {
> > > > > > > > >       var doc = window.document;
> > > > > > > > >       var a =   $('<div>test div</div>', doc);
> > > > > > > > >       alert(top.left.document.body.innerHTML);
> > > > > > > > >       $('#show', doc).toggle();
> > > > > > > > > }
>
> > > > > > > > > </script>
> > > > > > > > > <FRAMESET cols="20%, 80%">
> > > > > > > > >   <FRAME name=left src="testleft.html">
> > > > > > > > >   <FRAME name=right src="testright1.html">
> > > > > > > > > </FRAMESET>
> > > > > > > > > </html>- Hide quoted text -
>
> - Show quoted text -

Reply via email to