0
"개체"라는 다른 콤보 상자를 채우는 JSP 페이지에 다음과 같은 Combobox "페이지 선택"을 동적으로 추가합니다. 페이지 드롭 다운이 콘텐츠로 올바르게로드되지만 이벤트를 트리거하지 않음 그 위에. 즉 populateObjects. 나는 populateObjects() 함수에 경고를 유지했다.이 함수는이 경고를 호출하지 않는다는 것을 보여준다. 도와주세요.드롭 다운의 onclick 이벤트가 호출되지 않습니다
//Select Page
var cell4 = row.insertCell(3);
var element4 = document.createElement("select");
element4.setAttribute('id', 'selPageRow' + rowCount);
element4.setAttribute('name', 'selPageRow' + rowCount);
element4.setAttribute('onClick', 'javascript:populateObjects(this.options[this.selectedIndex].innerHTML,'+rowCount+');');
var PageArray = getPages();
var option = document.createElement("option");
option.text = "Select...";
option.value = "select";
element4.options.add(option);
for(var i=0;i<PageArray.length;i++)
{
var option = document.createElement("option");
option.text = PageArray[i].attributes[0].nodeValue;
option.value = PageArray[i].attributes[0].nodeValue;
element4.options.add(option);
}
cell4.appendChild(element4);
// Code for populating Object dropdown
function populateObjects(selectedValue,rowCount)
{
alert(selectedValue);
var SelBox = document.getElementById('selObjRow' + rowCount);
removeAllOptions(SelBox);
var ObjArry = getObjects(selectedValue);
var option = document.createElement("option");
option.text = "Select...";
option.value = "select";
SelBox.options.add(option);
if(ObjArry.length>0)
{
for(var i=0;i<ObjArry.length;i++)
{
var option = document.createElement("option");
option.text = ObjArry[i].attributes[0].nodeValue;
option.value = ObjArry[i].attributes[0].nodeValue;
SelBox.options.add(option);
}
}
else
{
var option = document.createElement("option");
option.text = "None";
option.value = "none";
SelBox.options.add(option);
}
cell5.appendChild(SelBox);
}
코드 – Ygg
미안 해요하지만,이 바이올린은 무엇과 [바이올린] (http://jsfiddle.net/)를 제공하시기 바랍니다? –
'rowCount'는 어디에 설정되어 있습니까? 내가 볼 수있는 것에서는 절대 정의하지 않습니다. – michaelb958