2009年5月28日木曜日

後からselectボックスを出力

function SetOptions(){
//ボックスの数を数える
var box_num = $$('div.change_box').length;

for (var i = 1; i <= box_num; i++){
var tr_num = $$('table#tbl'+i+' tr').length;
var select = document.createElement('select');
select.id = 'tble'+i;

for (var j = 1/*一行目はタイトル*/; j< tr_num;j++){
var cust_name = $('tbl'+i).down('tr', j).down('td', 1).innerHTML;
var option = document.createElement('option');
option.value = cust_name;
option.appendChild(document.createTextNode(cust_name));
select.appendChild(option);
}
$('tbl'+i+'_span').appendChild(select);
}
}

0 件のコメント:

コメントを投稿