简单的方法来显示网页上的.txt文件中的数据? [英] simple way to display data in a .txt file on a webpage?
问题描述
在一个项目上工作时,其中一个网页将显示一个人员列表(特别是毕业班上尚未定位的人员列表)。
而不是手动更新表中的这些列表,这是一个骨头Web 1.0的方式,我想要提交名称列表,将它们转换为一个简单的.txt列表,然后在列表中显示该列表网页。
到目前为止,简单的方法是使用iframe元素......唯一的事情是,我不能(或不知道如何)将任何文本样式应用于iframe的内容。我已经发布了一个我能够在这里完成的示例: http://dongarber.com/test/ /helpus-iframetest.html
默认字体是快递,客户端可能不会太热衷于此。
有没有更好的方式来做到这一点,这不需要ASP.NET或数据库?
#列表p {
字体:arial;
font-size:14px;
}
...
帮助我们找到1961年高中班级的所有同学。如果您知道& amp; amp; ;他们居住的地方或他们的电子邮件地址与留尼旺委员会联系。< / p>
< p>& nbsp;< / p>
< div id =list>< p>< iframe src =missingmen.txtwidth = 200 height = 400 frameborder = 0>< / iframe>< / p><<< ; / DIV>
< / div>
简单的方法:
missingmen.txt
重命名为 missingmen.html
。
missingmen.html
的顶部:
<链接href =txtstyle.css =stylesheettype =text / css/>
txtstyle.css
,并添加一行如下:
html,body {font-family:Helvetica,Arial,sans-serif}
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 where they live or their e-mail addresses contact the Reunion Committee.</p>
<p> </p>
<div id="list"><p><iframe src="missingmen.txt" width=200 height=400 frameborder=0 ></iframe></p></div>
</div>
Easy way:
- Rename
missingmen.txt
tomissingmen.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}
这篇关于简单的方法来显示网页上的.txt文件中的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!