Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
342 views
in Technique[技术] by (71.8m points)

html - simple way to display data in a .txt file on a webpage?

Working on a project, one of the webpages will display a list of people (specifically, a list of people from a graduation class that haven't been located yet). Instead of manually updating these lists in tables which is a boneheaded Web 1.0 way of doing it, I'd like to take the submitted list of names, convert them to a simple .txt list, and then display that list on the webpage.

So far, the easist way to do this is to use an iframe element... only thing is, I cannot (or don't know how to) apply any text styling to the contents of the iframe. I've published a sample of what I've been able to accomplish here: http://dongarber.com/test//helpus-iframetest.html

The default font is courier, and the client probably ain't gonna be too keen on it. Is there a better way to do this, that's doesn't require ASP.NET or a database?

#list  p {
    font: arial;
    font-size: 14px;
}

...


    <p>Help us locate all of our classmates from the High School class of 1961. If  you know&nbsp;where they live&nbsp;or their e-mail addresses contact the Reunion Committee.</p>
    <p>&nbsp;</p>
    <div id="list"><p><iframe src="missingmen.txt" width=200 height=400 frameborder=0 ></iframe></p></div>



  </div>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Easy way:

  • Rename missingmen.txt to missingmen.html.
  • Add a single line to the top of missingmen.html:
    <link href="txtstyle.css" rel="stylesheet" type="text/css" />
  • Create a file called txtstyle.css, and add to it a line like this:
    html, body {font-family:Helvetica, Arial, sans-serif}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...