동적으로 생성 된 행에 드롭 다운 상자가 있습니다. 화면 안에 그 상자를 채우고 있습니다. cfquery를 사용하여 SQL 서버에서 정보를 가져 와서 드롭 다운 상자를 채울 수있는 방법이 있습니까? 나는 자바 스크립트 내에서 그것을하고 싶습니다? 여기 javascript 및 coldfusion을 사용하여 동적으로 생성 된 드롭 다운 상자를 채우는 방법
내 코드입니다 :<script language="javascript" type="text/javascript">
function addRow() {
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length;
var iteration = lastRow;
var row = tbl.insertRow(lastRow);
// left cell
var cellLeft = row.insertCell(0);
var textNode = document.createTextNode(iteration-3);
cellLeft.appendChild(textNode);
// select cell
var cellRightSel = row.insertCell(1);
var sel = document.createElement('select');
sel.name = 'sectCode' + iteration;
sel.id = 'sectCode' + iteration;
sel.options[0] = new Option('---Any---', '0');
sel.options[1] = new Option('Level 0.5: test1, '1');
sel.options[2] = new Option('Level I: test2', '2');
sel.options[3] = new Option('Level I.D: test3', '3');
sel.options[4] = new Option('Level II.1: test4', '4');
sel.options[5] = new Option('Level II.5: test5', '5');
cellRightSel.appendChild(sel);
}
JavaScript를 사용하면 아마 ColdFusion 페이지의 드롭 다운 상자를 채울 수있는 가장 어려운 방법 일 것입니다. 더 쉬운 방법이 있습니까? –
나는 쉬운 길을 열어두고있다. – tnbumbray