Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Mar 2002
    Posts
    164
    Thanks
    0
    Thanked 0 Times in 0 Posts

    write out contents of js file

    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"

  2. #2
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    Coppell, Texas, USA
    Posts
    168
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: write out contents of js file

    <hr>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.<hr>

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •