Mozilla document.createElement('script') Blank page

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mmcc128@gmail.com

    #1

    Mozilla document.createElement('script') Blank page

    When I call this...

    -------------------------
    function funcWinTopJS(){
    var s = document.create Element('script ');
    s.type = "text/javascript";
    s.src = "Javascript/Master.asp";
    document.docume ntElement.appen dChild(s)
    }
    ----------------------------

    The window goes blank in Mozilla. It works great in IE 6. Any clue?
    Thanks, inadvance.

    MM

  • Martin Honnen

    #2
    Re: Mozilla document.create Element('script ') Blank page



    mmcc128@gmail.c om wrote:
    [color=blue]
    > When I call this...
    >
    > -------------------------
    > function funcWinTopJS(){
    > var s = document.create Element('script ');
    > s.type = "text/javascript";
    > s.src = "Javascript/Master.asp";
    > document.docume ntElement.appen dChild(s)[/color]

    A <script> element should be a descendant of the <head> or <body> but
    not a child of <html> so make that
    document.body.a ppendChild(s);

    [color=blue]
    > The window goes blank in Mozilla. It works great in IE 6. Any clue?[/color]

    Probably does not result from the function itself but the way you call
    the function.
    Where/How do you call the function?


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/

    Comment

    • mmcc128@gmail.com

      #3
      Re: Mozilla document.create Element('script ') Blank page

      Well, it was in a page with frames - and it was at the top within the
      script tags. I've since gotten around it - but never got it to work.
      The issue is gone - but Ive found that referencing "document" when
      using Mozilla is very important.

      We are jsut starting to make our app cross browser compliant (only IE
      before) and...well, its not fun. IE is too forgiving and makes us lazy.

      Comment

      Working...