right & wrong

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

    #1

    right & wrong


    This script works, but how can I write it better ?
    Without the comment tags ....

    <script>
    <!--
    document.write( '<SCRIPT SRC="../scripts/sp'+lang+'.js"> </script>')
    // -->
    </script>

    --

    find clausen

  • Lasse Reichstein Nielsen

    #2
    Re: right &amp; wrong

    find clausen <> writes:
    [color=blue]
    > This script works, but how can I write it better ?[/color]

    Please define "better".
    [color=blue]
    > Without the comment tags ....[/color]

    Easy, don't write them.
    [color=blue]
    > <script>
    > <!--
    > document.write( '<SCRIPT SRC="../scripts/sp'+lang+'.js"> </script>')
    > // -->
    > </script>[/color]

    Try:
    <script type="text/javascript">
    document.write( '<script src="../scripts/sp'+lang+'.js"> <\/script>');
    </script>

    It remembers the type attribute (*required* by HTML 4), and omits the
    comment tags, escapes the </ inside the script tag, as required by
    HTML (and remembers the semicolon at the end).

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • find clausen

      #3
      Re: right &amp; wrong

      On Sat, 24 Jan 2004 12:13:34 +0100, Lasse Reichstein Nielsen
      <lrn@hotpop.com > wrote:
      [color=blue]
      > Try:
      > <script type="text/javascript">
      > document.write( '<script src="../scripts/sp'+lang+'.js"> <\/script>');
      > </script>[/color]


      Of course :-)
      It irritates me because I see this on Google:

      ') // -. juli 2003.

      Thanx Lasse

      --

      find clausen

      Comment

      Working...