我在頁面加載時爲組織名稱列表動態構建SELECT表單對象。我使用的是數字值,因爲我根據選擇框引用了組織信息。將SELECT對象的選定值提交給動態創建的列表
我想動態改變一個隱藏字段的值時,SELECT框被改變,但我只能得到的價值。我嘗試在OPTION標籤中包含組織名稱作爲「標題」,但似乎無法檢索標題。任何建議將不勝感激。
代碼來構建選擇框:
dim OrgList(200)
OrgSelect="<select name='Orgs' onchange='OrgPick(this);'>"&vbCrLf
OrgSelect=OrgSelect&"<option value='none' selected>Select one...</option>"&vbCrLf
OrgCount=0
rOrgList.movefirst
do while not rOrgList.eof
OrgList(OrgCount)=rOrgList("OrganizationName")
OrgSelect=OrgSelect&"<option value='"&OrgCount&"'>"&rOrgList("OrganizationName")&"</option>"&vbCrLf
OrgCount=OrgCount+1
rOrgList.movenext
loop
OrgSelect=OrgSelect&"</select>"
更新 - 2013年12月11日11:22
我OrgPick()JavaScript函數,沒有工作:
function OrgPick(data)
{
document.getElementById("yourPick").value = data.title;
}
此外,將選擇框代碼的第8行更改爲:
OrgSelect=OrgSelect&"<option value='"&OrgCount&"' title='"&rOrgList("OrganizationName")&"'>"&rOrgList("OrganizationName")&"</option>"&vbCrLf
OrgPick()函數是做什麼的?你能爲此發佈代碼嗎? –
「OrgPick()」函數正是我用來更新隱藏值對象的。 – dcoughler