从 HTML 中的 txt 文件加载数据
我有一个简单的代码,
<ul id="scroller">
<li>Consulting Manager- China</li>
<li>Junior Business Consultant- Saudi Arabia</li>
<li>Project Manager- Germany</li>
<li>Consulting Manager- Dubai</li>
<li>Project Manager- South Africa</li>
<li>Consulting Manager- Greece</li>
<li>Senior Consulting Manager- Europe</li>
</ul>
这是标准的 我想要做的是从服务器上的文本文件加载这些数据,而不使用java 是否可以?
我想在文本文件和浏览器之间链接
I have a simple code where
<ul id="scroller">
<li>Consulting Manager- China</li>
<li>Junior Business Consultant- Saudi Arabia</li>
<li>Project Manager- Germany</li>
<li>Consulting Manager- Dubai</li>
<li>Project Manager- South Africa</li>
<li>Consulting Manager- Greece</li>
<li>Senior Consulting Manager- Europe</li>
</ul>
this is standard
what i want to do is to load this data from a text file on the server without using java
is it possible?
I want to link between text file and browser
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
HTML 不是一种编程语言。它是一种标记语言,旨在定义文档,仅此而已。您不能用纯 HTML 编写程序。
现在,有一些语言允许定义文档和编写程序(想想PostScript),但 HTML 则不然。您可以在现代网站中找到的附加功能是由与 HTML 交互的其他语言和技术提供的:CSS、JavaScript、Java、Flash...
实现目标的最明显的工具是 JavaScript。这是个好消息,因为 JavaScript 不是 Java :)
看一下这个 jQuery 示例大致按照你的要求做。 jQuery 是一个流行的 JavaScript 库,非常易于使用。
HTML is not a programming language. It's a mark-up language designed to define documents and nothing else. You can't write programs in plain HTML.
Now, there are some languages that allow to define documents and write programs (think of PostScript) but it's not the case of HTML. The additional functionalities you can find in modern web sites is provided by other languages and technologies that interact with HTML: CSS, JavaScript, Java, Flash...
The most obvious tool to accomplish your goals is JavaScript. That's good news because JavaScript is not Java :)
Have a look at this jQuery example that roughly does what you are asking. jQuery is a popular JavaScript library that's quite easy to use.
您无法单独使用 HTML 来处理文本文件。
如果文本文件位于服务器上,则必须使用服务器端脚本(例如 PHP)直接处理它,或者使用客户端脚本(例如 JavaScript)从服务器下载文件然后处理它。
You cannot process a text file using HTML alone.
If the text file is located on the server, you either have to use server-side scripting (e.g. PHP) and process it directly or client side scripting (e.g. JavaScript) to download the file from the server and then process it.