我想让我的JS在我的表单框中列出我的名字VERTICALLY,但它只出现在HORIZONTALLY中,你知道为什么吗?谢谢。 这是我的脚本:JavaScript排序功能
// initialize the counter and the array
var numnames=0;
var names = new Array();
function SortNames() {
// Get the name from the text field
thename=document.theform.newname.value;
// Add the name to the array
names[numnames]=thename;
// Increment the counter
numnames++;
// Sort the array
names.sort();
document.theform.sorted.value=names.join("\n");
}
什么是'document.theform.sorted'?一个'textarea'? –