SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Enthusiast alnixon's Avatar
    Join Date
    May 2001
    Location
    Preston (UK)
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    text file as a variable?

    I have a text file, the contents of which I would like to use as the value of a variable in Javascript. is this possible?

    how about importing it as the value of a (invisible) text box and acquiring it this way?

    Any ideas or suggestions appreciated as resorting to shockwave seems a bit extravagant.

    thanks.
    Da Big Cheese
    --------------
    I'm not entirely sure on this, but ....
    [insert my post here]

  2. #2
    SitePoint Zealot jonsteele's Avatar
    Join Date
    Jan 2001
    Location
    Toronto
    Posts
    106
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you can use SSI/ASP/PHP/etc. you could include it serverside.

    If not, you could try having the following in the text file

    myVar = "whatever value was originally stored in the text file"

    Then, you can just include it using:

    <script src="filename" type="text/javascript">


Bookmarks

Posting Permissions

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