简体   繁体   中英

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. 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.

 x = 'AppManager,Downloads,myPictures' document.getElementById('openAppsList').innerHTML = x.replace(/\,/g, '<br/>');
 <html> <body><div id="openAppsList"></div> </body> </html>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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