简体   繁体   English

如何在 div 中显示 javascript 列表中的所有项目?

[英]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.

相关问题 如何在javascript中相互比较两个列表项? - How do I compare two list items against each other in javascript? 如何在javascript中显示带有数组项的div - How to display a div with items from array in javascript 如何显示每个带有.className的div的图像? - How do I display the first image from each div with .className? 如何将所有ul和li保留在父li下:selected,但删除其他导航项 - How do I keep all ul and li's under a parent li:selected, but remove other navigation items 在JavaScript中访问特定div下的所有项目 - Access all items under specific div in javascript 将列表中的项目显示到 div 中 - Display items from list into a div 如何从arrayB删除arrayA中的所有项目? 在JavaScript中 - How do I remove all items in arrayA from arrayB? in javascript 单击“全选”后,如何取消选中先前选择的其他选定列表项? - How do I uncheck the other selected list items that was previously select after I click on “Select All”? 如何清除 Javascript 中的列表,即一键删除列表中的所有项目? - How do you clear a list in Javascript, i.e. delete all items in a list with one button click? 在 Javascript 中如何防止在 setTimeout 持续时间内调用其他函数? - In Javascript How do I prevent other functions from being invoked while under the setTimeout duration?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM