firefox scripts array

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

    firefox scripts array

    Hey if I have a script id is script1 and the src is test1.js in a html
    page in firefox, how do I change that dynamically?

    because script1.src = "test2.js"; ain't working.
  • DU

    #2
    Re: firefox scripts array

    Bryan wrote:
    [color=blue]
    > Hey if I have a script id[/color]

    script elements do not take id attribute


    is script1 and the src is test1.js in a html[color=blue]
    > page in firefox, how do I change that dynamically?
    >[/color]



    var collScriptEleme nts = document.getEle mentsByTagName( "script");
    collScriptEleme nts[intIndex].src = "path\/test2.js";
    [color=blue]
    > because script1.src = "test2.js"; ain't working.[/color]

    Not tested. Hey an url would have been useful.

    DU

    Comment

    • Thomas 'PointedEars' Lahn

      #3
      Re: firefox scripts array

      DU wrote:
      [color=blue]
      > Bryan wrote:[color=green]
      >> Hey if I have a script id[/color]
      >
      > script elements do not take id attribute
      > http://www.w3.org/TR/html401/interac...ml#edef-SCRIPT[/color]

      They do in Valid XHTML 1.0

      <http://www.w3.org/TR/xhtml1/dtds.html#dtden try_xhtml1-strict.dtd_scri pt>
      <http://www.w3.org/TR/xhtml1/dtds.html#dtden try_xhtml1-transitional.dt d_script>

      so you can use (mostly) standards compliant

      var s = document.getEle mentById("scrip t_id");
      if (s)
      {
      s.src = "...";
      }

      there. Whether using XHTML on the Web these days is a wise decision is
      another matter, though: <http://www.hut.fi/u/hsivonen/xhtml-the-point>


      PointedEars

      Comment

      Working...