Condition insertion

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

    Condition insertion

    Is it possible to make a file insertion conditional?

    I now have the code
    '<script type="text/javascript" src="http://www.site.com/showit.js">'

    And I wondered if it is possible to make this conditional, something like:
    if (mycondition==t rue) include('http://www.site.com/showit.js');

    Thanks,

    Wim


  • Martin Honnen

    #2
    Re: Condition insertion



    Wim Roffal wrote:
    [color=blue]
    > Is it possible to make a file insertion conditional?
    >
    > I now have the code
    > '<script type="text/javascript" src="http://www.site.com/showit.js">'
    >
    > And I wondered if it is possible to make this conditional, something like:
    > if (mycondition==t rue) include('http://www.site.com/showit.js');[/color]

    Don't you know document.write?
    <script type="text/javascript">
    if (mycondition) {
    document.write(
    '<script type="text/javascript" src="file.js">< \/script>');
    }
    </script>

    --

    Martin Honnen


    Comment

    • Thomas 'PointedEars' Lahn

      #3
      Re: Condition insertion

      Martin Honnen wrote:
      [color=blue]
      > Wim Roffal wrote:[color=green]
      >> And I wondered if it is possible to make this conditional, something like:
      >> if (mycondition==t rue) include('http://www.site.com/showit.js');[/color]
      >
      > Don't you know document.write?
      > <script type="text/javascript">
      > if (mycondition) {
      > document.write(
      > '<script type="text/javascript" src="file.js">< \/script>');
      > }
      > </script>[/color]

      Note that this is likely to fail in NN4 due to the NRLB.
      (I think we had this discussion before.)


      PointedEars

      Comment

      • Lasse Reichstein Nielsen

        #4
        Re: Condition insertion

        Thomas 'PointedEars' Lahn <PointedEars@nu rfuerspam.de> writes:
        [color=blue]
        > Note that this is likely to fail in NN4 due to the NRLB.[/color]

        Do you have an English language refrence for this "NRLB"?

        All I can find is:
        <URL:http://gml-modul.sourcefor ge.net/cgi-bin/gmL?Sprache=en& domain=dhtml-tutorial&webpag e=662>,
        and even with google translation, I can't make much sense of it.

        /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

        • Thomas 'PointedEars' Lahn

          #5
          Re: Condition insertion

          Lasse Reichstein Nielsen wrote:[color=blue]
          > Thomas 'PointedEars' Lahn <PointedEars@nu rfuerspam.de> writes:[color=green]
          >> Note that this is likely to fail in NN4 due to the NRLB.[/color]
          >
          > Do you have an English language refrence for this "NRLB"?[/color]

          Sorry, no.
          [color=blue]
          > All I can find is:
          > <URL:http://gml-modul.sourcefor ge.net/cgi-bin/gmL?Sprache=en& domain=dhtml-tutorial&webpag e=662>,
          > and even with google translation, I can't make much sense of it.[/color]

          Maybe you should ask Georg, he could possibly provide a proper
          English explanation. I would like to provide it, but I have no
          time for translating that document.


          PointedEars

          Comment

          Working...