SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    text from an outside source

    i want to get text into a div named myText from an outside source .
    so i have this code in an onLoad funtion:

    Code:
    document.getElementById("myText").innerHTML=url(test.txt);

    and this in the html:
    HTML Code:
    <div id="myText"> some text</div>
    i thought that i can write my text in a txt file called text simillar to action script... but i guess i am wrang......

  2. #2
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what does your url function do? There is no native function with that name. You will have to use Ajax if you want to get the context of a text file to be shown in a DIV.

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i simply want to update "mytext" from an ouside source like a simple txt without using
    php or asp....

  4. #4
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Right, then see above.

  5. #5
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    xmlHttpRequest?

    so do i have to use this ?
    isnt it very complicated if all i need is just to connect to one txt file ?
    all i found is that XML HttpRequest works with forms and for more complicated things so i am not sure how to use it to simply connect to an txt file..

  6. #6
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Google for "Ajax" or "XMLHTTPRequest" tutorials. Apple has a good one


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
  •