• write out contents of js file

    Author
    Topic
    #379397

    I’m hoping there is some way I can use ASP to write out the contents of a .js file? I have a scrolling news item on my website, which includes a .js file with the contents. I’d like to be able to point my content providers to a page that dynamically outputs the js file content to a asp or htm page so it can be viewed more easily. Is this possible. Here is my js file…

    var messages=new Array()
    messages[0]=”sample scrolling text”
    messages[1]=”sample scrolling text”
    messages[2]=”sample scrolling text”
    messages[3]=”sample scrolling text”
    messages[4]=”sample scrolling text”

    Viewing 0 reply threads
    Author
    Replies
    • #631627

      [indent]


      I’d like to be able to point my content providers to a page that dynamically outputs the js file content to a asp or htm page so it can be viewed more easily.


      [/indent]

      This will sound strange but: I’m not sure exactly what you’re trying to do, but yes, you can do it. The reason I say that is there are methods for reading and writing files and specifying the content type, so you can do just about anything with content. I’m just not clear what your content providers are doing and how it fits into this. Are they submitting content that needs to be incorporated in your js file? Or are you just looking for a way to create javascript source from an ASP script?

      The later is simple becuase you don’t need to use the .js extension – that’s just convention. You could use an ASP file as the source for javascript, just change the Content Type to javascript

      Response.ContentType = “text/javascript”

      and you’re on your way. If that’s not it, can we get an example of what you’re using this for?

      HTH

    Viewing 0 reply threads
    Reply To: write out contents of js file

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: