81,094
社区成员
发帖
与我相关
我的任务
分享
<html>
<head></head>
<script language="javascript">
var items = new Array();
function display() {
var view = document.getElementById("items");
var content = "";
for (var val in items) {
content = content + "<li>" + val + "</li>";
}
view.innerHTML = content;
}
function doPop() {
var val = prompt("please input item:");
items[val] = val;
display();
}
</script>
<body>
<input type="button" value="new item" onclick=doPop()>
<div id="items">
</div>
</body>
</html>