我想讓我的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'? –