customising external .js files

Discussion in 'ASP General' started by mark | r, Sep 9, 2003.

  1. mark | r

    mark | r Guest

    can you use asp to customise external js files e.g.

    <script src="fred.js"></script>

    where fred gets the page id and changes an image in the .js file to suit?

    mark
     
    mark | r, Sep 9, 2003
    #1
    1. Advertising

  2. mark | r

    Tom B Guest

    What I would do, is have a function in fred.js that accepts a parameter

    For example in fred.js

    function Start(aString)
    {
    alert(aString);
    }

    then in your "asp" code...

    <%
    Dim sString
    sString="'Hello'"
    %>

    <script src="fred.js"></script>
    <script language=Javascript>
    Start(<%=sString%>)
    </script>

    which would result in
    <script src="fred.js"></script>
    <script language=Javascript>
    Start('Hello')
    </script>


    "mark | r" <> wrote in message
    news:3f5e0376$0$261$...
    > can you use asp to customise external js files e.g.
    >
    > <script src="fred.js"></script>
    >
    > where fred gets the page id and changes an image in the .js file to suit?
    >
    > mark
    >
    >
     
    Tom B, Sep 9, 2003
    #2
    1. Advertising

  3. mark | r

    mark | r Guest

    wjat i mean is can the contents of a .js file be built?

    mark
     
    mark | r, Sep 9, 2003
    #3
  4. mark | r

    Ray at Guest

    <script src="fred.ASP">

    Use that, and then in fred.asp, response.write your client-side code as
    needed.

    Ray at work

    "mark | r" <> wrote in message
    news:3f5e112e$0$265$...
    > wjat i mean is can the contents of a .js file be built?
    >
    > mark
    >
    >
     
    Ray at, Sep 9, 2003
    #4
  5. mark | r

    Chris Barber Guest

    I suppose you could ask ... why? If it's dynamic then what's the point of it
    being a src="" since there is no point in caching it.

    Generalise your scripts enough to be cacheable and then put the dynamic
    stuff direct into the html page?

    Do you have a specific aim in mind for this since it's not clear what the
    context or final intention is?

    Chris.


    "mark | r" <> wrote in message
    news:3f5e112e$0$265$...
    wjat i mean is can the contents of a .js file be built?

    mark
     
    Chris Barber, Sep 9, 2003
    #5
  6. "Chris Barber" wrote:
    >
    > I suppose you could ask ... why? If it's dynamic then what's
    > the point of it being a src="" since there is no point in
    > caching it.


    One reason comes to mind. I believe it has been explored in
    ms.public.scripting.jscript as a means for hiding source code from prying
    eyes. I don't recall the consensus on its effectiveness, however.


    --
    Dave Anderson

    Unsolicited commercial email will be read at a cost of $500 per message. Use
    of this email address implies consent to these terms. Please do not contact
    me directly or ask me to contact you directly for assistance. If your
    question is worth asking, it's worth posting.
     
    Dave Anderson, Sep 9, 2003
    #6
  7. mark | r

    mark | r Guest

    its an include to hide a non accessible element from a text browser.

    mark

    "Dave Anderson" <> wrote in message
    news:...
    > "Chris Barber" wrote:
    > >
    > > I suppose you could ask ... why? If it's dynamic then what's
    > > the point of it being a src="" since there is no point in
    > > caching it.

    >
    > One reason comes to mind. I believe it has been explored in
    > ms.public.scripting.jscript as a means for hiding source code from prying
    > eyes. I don't recall the consensus on its effectiveness, however.
    >
    >
    > --
    > Dave Anderson
    >
    > Unsolicited commercial email will be read at a cost of $500 per message.

    Use
    > of this email address implies consent to these terms. Please do not

    contact
    > me directly or ask me to contact you directly for assistance. If your
    > question is worth asking, it's worth posting.
    >
    >
     
    mark | r, Sep 10, 2003
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. wh1974
    Replies:
    0
    Views:
    2,454
    wh1974
    Jan 12, 2005
  2. David
    Replies:
    3
    Views:
    517
    Kenneth P. Turvey
    Nov 12, 2006
  3. ameyas
    Replies:
    3
    Views:
    1,227
  4. Peter

    Customising Tk widgets

    Peter, Sep 21, 2010, in forum: Python
    Replies:
    2
    Views:
    247
    Arndt Roger Schneider
    Sep 21, 2010
  5. Mark Carter
    Replies:
    2
    Views:
    1,070
    Mark Carter
    Feb 11, 2011
Loading...

Share This Page