简体   繁体   English

仅使用HTML打开文本文件

[英]Opening a text file using HTML only

I have been assigned a project where I must select and display a txt file only using HTML AND CSS. 我被分配了一个项目,在该项目中,必须仅使用HTML和CSS选择和显示txt文件。 I have already learned how to use JavaScript, JQuery, and PHP do to this but this project requires HTML and CSS only. 我已经学习了如何使用JavaScript,JQuery和PHP来做到这一点,但是该项目仅需要HTML和CSS。 So far I have mainly tried using the to select my file and that seems to work fine but I can't figure out how to obtain the value of the file without using js,JQuery, or PHP, and to display the txt file I have tried using the which seems like the only way to display a txt file with only HTML, but I do not know. 到目前为止,我主要尝试使用来选择我的文件,这似乎很好用,但是我不知道如何在不使用js,JQuery或PHP的情况下获取文件的值,以及显示我拥有的txt文件尝试使用,这似乎是仅显示HTML的txt文件的唯一方法,但我不知道。 Any advice would be appreciated, thanks. 任何建议,将不胜感激,谢谢。

HTML and CSS provide no mechanism to achieve this. HTML和CSS没有提供实现此目的的机制。

The closest you could come would be to link to the text file or show it in an iframe, but there is no way to dynamically determine which file to link to with HTML/CSS alone. 您可能最接近的是链接到文本文件或将其显示在iframe中,但是无法动态确定仅通过HTML / CSS链接到哪个文件。

If you want to process user input then you need a programming language. 如果要处理用户输入,则需要一种编程语言。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM