37 users online (0 members and 37 guests)  


  Results 1 to 9 of 9

Related

  1. document.getElementById    Forum: Javascript Forum
    Replies: 0
  2. custom 404 error document    Forum: HTML Forum
    Replies: 1
  3. document.getElementByID    Forum: Javascript Forum
    Replies: 6
  4. Replies: 8
  1. #1
    MGSWorld's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2005
    Posts
    8

    Linking to an external .txt-document?

    How do I add an external .txt'document into a page? Like if I'm having a document called 'article1.htm' and want the text from 'articles/ar1.txt' to be shown in a specific table on the page. I would a ppreciate an answer.

    Thanks.

  2. #2
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732

    Re: Linking to an external .txt-document?

    Hi there MGSWorld,

    and a warm welcome to these forums.

    Have you considered using an iframe for this?
    Code:
    <iframe src="articles/ar1.txt" width="400" height="300"><iframe>
    Try one out at W3Schools

    coothead

  3. #3
    MGSWorld's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2005
    Posts
    8

    Re: Linking to an external .txt-document?

    Thanks, i'll try that one out instantly. You know, i'm not too familiar with html, cause there are good porgrams where you don't need it (did I say dreamweaver? )

    But ofcourse I know SOME code, so this will fir me perfectly. Thanks.

  4. #4
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732

    Re: Linking to an external .txt-document?

    No problem, you're welcome.

  5. #5
    MGSWorld's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2005
    Posts
    8

    Re: Linking to an external .txt-document?

    Sorry, but I can't get it to work. I tried to change the last iframe-tag to </iframe> but it didn't work either. Do you know what can be wrong? The actual source is news/text/z0001.txt.

    It will just show an empty box.

  6. #6
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732

    Re: Linking to an external .txt-document?

    Hi there MGSWorld,

    oooops, sorry about the 'typo' in the snippet of code that I provided. Of course, the closing tag should be </iframe>.

    Try using the full url for the file and see if that works.

    coothead

  7. #7
    MGSWorld's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2005
    Posts
    8

    Re: Linking to an external .txt-document?

    Nope, it didn't work. My purpose is to use it as a news-system. I've heard of better ones, but my site has a pretty good template and I don't want to start from scratch. I'm on to a reconstruction of it now, and that's why I'm thinking of starting this system now.

    Do you know any better system? I've heard of RSS, but it's seems to compicated to use if I'm not learning it.

  8. #8
    MGSWorld's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2005
    Posts
    8

    Re: Linking to an external .txt-document?

    It DOES work, I cpoied the code from your example page and changed a few things, but it's still jsut plain text. Is it possible to change it to my own styles, like yellow text?

  9. #9
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732

    Re: Linking to an external .txt-document?

    Hi there MGSWorld,
    ....but it's still just plain text
    Well, what else would you expect for a .txt file?
    Is it possible to change it to my own styles, like yellow text?
    Yes, use an .html file instead.
    Here is a simple example....

    ar1.html
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>text displayed in colour</title>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    
    <style type="text/css">
    <!--
    body {
         font-family:verdana,arial,helvetica,sans-serif;
         font-size:medium;
         color:#ff0;
         background-color:#00f;
     }
    //-->
    </style>
    
    </head>
    <body>
    
    <div>
    
    Place the contents of your text file here.
    
    </div>
    
    </body>
    </html>
    coothead



Tags for this Thread