var= new Script(); ???

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • me

    var= new Script(); ???

    Hey all,

    is it possible to make a vari =new Script(); object?

    like when you do new Image(); or new Iframe()?

    Cheers.

    me
    _______________ _______________ _______________ _______________ ______ k zobra
    ICQ#: 97557460 Current ICQ status: + More ways to contact me
    _______________ _______________ _______________ _______________ ______


  • Martin Honnen

    #2
    Re: var= new Script(); ???



    me wrote:[color=blue]
    > is it possible to make a vari =new Script(); object?
    >
    > like when you do new Image(); or new Iframe()?[/color]

    Which browser supports
    new Iframe()
    ??
    The W3C DOM allows you to create any element with
    document.create Element('tagnam e')
    so
    if (document.creat eElement) {
    var script = document.create Element('script ');
    }
    creates the <script> element. However getting it to load a script
    dynamically is very browser dependant, Netscape 7 should do, Opera 7.20
    doesn't do it, and IE5+ should do:

    var script;
    if (document.creat eElement && ((script =
    document.create Element('script ')))) {
    script.type = 'text/javascript';
    script.src = 'test20031102.j s';
    var heads = document.getEle mentsByTagName( 'head');
    if (heads[0]) {
    heads[0].appendChild(sc ript);
    }
    }
    --

    Martin Honnen


    Comment

    • me

      #3
      Re: var= new Script(); ???

      Thanks :)

      pd Iframe(0 was wrong hehe
      function createIframe()
      {
      var myIframe = new Iframe;
      return myIframe;
      }

      var frameObj=create Iframe();

      frameObj.docume nt.body.innerHT ML="<b>Hey There</b>";
      //Writing something into the iframe
      or your way with createElement

      thnks

      me

      "Martin Honnen" <mahotrash@yaho o.de> wrote in message
      news:3fa4e490$1 @olaf.komtel.ne t...[color=blue]
      >
      >
      > me wrote:[color=green]
      > > is it possible to make a vari =new Script(); object?
      > >
      > > like when you do new Image(); or new Iframe()?[/color]
      >
      > Which browser supports
      > new Iframe()
      > ??
      > The W3C DOM allows you to create any element with
      > document.create Element('tagnam e')
      > so
      > if (document.creat eElement) {
      > var script = document.create Element('script ');
      > }
      > creates the <script> element. However getting it to load a script
      > dynamically is very browser dependant, Netscape 7 should do, Opera 7.20
      > doesn't do it, and IE5+ should do:
      >
      > var script;
      > if (document.creat eElement && ((script =
      > document.create Element('script ')))) {
      > script.type = 'text/javascript';
      > script.src = 'test20031102.j s';
      > var heads = document.getEle mentsByTagName( 'head');
      > if (heads[0]) {
      > heads[0].appendChild(sc ript);
      > }
      > }
      > --
      >
      > Martin Honnen
      > http://JavaScript.FAQTs.com/
      >[/color]


      Comment

      Working...