Dynamic Include files

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

    Dynamic Include files

    Hi All

    I want to include javascript files based on the user location which I store
    in a session variable upon user login.

    The original code was like this

    <SCRIPT language=JavaSc ript src="test_files/calcholidays.js "></SCRIPT>

    We have multipe Javascript Script files and want to use the correct one
    based on the Location Variable.

    The variable is sLocation = Session("Locati on")

    We would like the include file to look something like this

    <SCRIPT language=JavaSc ript src="test_files/" & <%= sLocation %> &
    ".js"></SCRIPT>

    Not sure how to write this.

    Can someone please help


  • Evertjan.

    #2
    Re: Dynamic Include files

    JP SIngh wrote on 15 nov 2004 in
    microsoft.publi c.inetserver.as p.general:[color=blue]
    > I want to include javascript files based on the user location which I
    > store in a session variable upon user login.
    >
    > The original code was like this
    >
    > <SCRIPT language=JavaSc ript src="test_files/calcholidays.js "></SCRIPT>
    >
    > We have multipe Javascript Script files and want to use the correct
    > one based on the Location Variable.
    >
    > The variable is sLocation = Session("Locati on")
    >
    > We would like the include file to look something like this
    >
    > <SCRIPT language=JavaSc ript src="test_files/" & <%= sLocation %> &
    > ".js"></SCRIPT>
    >
    > Not sure how to write this.
    >
    > Can someone please help[/color]

    Please next time start with:

    Did you try this out?
    Did you look at the rendered source in your browser?
    Was it succesfull? If not, dit you get an error [what error]?

    =============== ===

    Try, after analyzing the differences with your code:

    <SCRIPT type="text/javascript"
    src="test_files/<% =Session("Locat ion") %>.js">
    </SCRIPT>

    And inspect the rendered html again.


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress,
    but let us keep the discussions in the newsgroup)

    Comment

    • JP SIngh

      #3
      Re: Dynamic Include files

      Yes I did try it out sir but it did not work.

      I don't know the syntax hence my question.

      Thanks you
      "Evertjan." <exjxw.hannivoo rt@interxnl.net > wrote in message
      news:Xns95A2722 137D05eejj99@19 4.109.133.29...[color=blue]
      > JP SIngh wrote on 15 nov 2004 in
      > microsoft.publi c.inetserver.as p.general:[color=green]
      > > I want to include javascript files based on the user location which I
      > > store in a session variable upon user login.
      > >
      > > The original code was like this
      > >
      > > <SCRIPT language=JavaSc ript src="test_files/calcholidays.js "></SCRIPT>
      > >
      > > We have multipe Javascript Script files and want to use the correct
      > > one based on the Location Variable.
      > >
      > > The variable is sLocation = Session("Locati on")
      > >
      > > We would like the include file to look something like this
      > >
      > > <SCRIPT language=JavaSc ript src="test_files/" & <%= sLocation %> &
      > > ".js"></SCRIPT>
      > >
      > > Not sure how to write this.
      > >
      > > Can someone please help[/color]
      >
      > Please next time start with:
      >
      > Did you try this out?
      > Did you look at the rendered source in your browser?
      > Was it succesfull? If not, dit you get an error [what error]?
      >
      > =============== ===
      >
      > Try, after analyzing the differences with your code:
      >
      > <SCRIPT type="text/javascript"
      > src="test_files/<% =Session("Locat ion") %>.js">
      > </SCRIPT>
      >
      > And inspect the rendered html again.
      >
      >
      > --
      > Evertjan.
      > The Netherlands.
      > (Please change the x'es to dots in my emailaddress,
      > but let us keep the discussions in the newsgroup)
      >[/color]


      Comment

      • Bob Barrows [MVP]

        #4
        Re: Dynamic Include files

        JP SIngh wrote:[color=blue]
        > Hi All
        >
        > I want to include javascript files based on the user location which I
        > store in a session variable upon user login.
        >
        > The original code was like this
        >
        > <SCRIPT language=JavaSc ript src="test_files/calcholidays.js "></SCRIPT>
        >
        > We have multipe Javascript Script files and want to use the correct
        > one based on the Location Variable.
        >
        > The variable is sLocation = Session("Locati on")
        >
        > We would like the include file to look something like this
        >
        > <SCRIPT language=JavaSc ript src="test_files/" & <%= sLocation %> &
        > ".js"></SCRIPT>
        >
        > Not sure how to write this.
        >[/color]
        To start with: don't use a vbscript concatenation expression when you've
        specified the language to be javascript. Use +, not &.

        Bob Barrows
        --
        Microsoft MVP - ASP/ASP.NET
        Please reply to the newsgroup. This email account is my spam trap so I
        don't check it very often. If you must reply off-line, then remove the
        "NO SPAM"


        Comment

        • Aaron [SQL Server MVP]

          #5
          Re: Dynamic Include files

          > <SCRIPT language=JavaSc ript src="test_files/" & <%= sLocation %> &
          ".js"></SCRIPT>

          Maybe you meant:

          <SCRIPT language=JavaSc ript src="test_files/<%= sLocation %>.js"></SCRIPT>

          --
          Please contact this domain's administrator as their DNS Made Easy services have expired.

          (Reverse address to reply.)


          Comment

          Working...