[英]How do I display all the items from a javascript list under each other in a div?
I'm working on a dummy operating-system in HTML.我正在 HTML 中开发一个虚拟操作系统。 In this operating system there is a program called the Application Manager.
在这个操作系统中有一个叫做应用程序管理器的程序。 A part of that program is to display a list of all the running applications.
该程序的一部分是显示所有正在运行的应用程序的列表。 Here is the code:
这是代码:
var x = activeApps
document.getElementById('openAppsList').innerHTML = x
The problem is, when I do this, the text that shows up on screen is this:问题是,当我这样做时,屏幕上显示的文本是这样的:
Is there any way that I can show the items under each other, like this:有什么方法可以显示彼此下方的项目,如下所示:
AppManager
Downloads
myPictures
I'm using vanilla JavaScript on a local Apache Server.我在本地 Apache 服务器上使用香草 JavaScript。
x = 'AppManager,Downloads,myPictures' document.getElementById('openAppsList').innerHTML = x.replace(/\,/g, '<br/>');
<html> <body><div id="openAppsList"></div> </body> </html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.