请教:为什么取不到selectedindex的值?

wenn_zh 2005-04-24 10:47:51
function displayinfo()
{
alert(document.setpersonform.itemselect.selectedindex);
document.setpersonform.infotext.value=info1[1];
}
<select name="itemselect" id="iteminfo" size=1 onchange="displayinfo()">
<%int i=1
do while not itemrs.eof
%>
<option value=<%=itemrs("itemid")%> ><%=itemrs("itemname")%></option>
<%
itemrs.movenext
loop%>
</select>





代码如上,我想在每次更改select的选项的时候,提示你是第几项但是每次都是返回undefined,请DX指教。
...全文
221 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
wenn_zh 2005-04-25
  • 打赏
  • 举报
回复
哦,真的是这样,多谢了
king2410 2005-04-25
  • 打赏
  • 举报
回复
selectedIndex
出开头外,首字母都要大写
mengqiuyu 2005-04-25
  • 打赏
  • 举报
回复
我也用过这个,不过,我用的时候写的都是selectedIndex(I大写),不知道会不会使这个原因
wenn_zh 2005-04-25
  • 打赏
  • 举报
回复
是啊,,我的form名字就是setpersonform
enjsky 2005-04-25
  • 打赏
  • 举报
回复
document.setpersonform.itemselect.selectedindex

中你的form的名字是:setpersonform马 ?
<from name="setpersonform">
<select ......>
</select>
</form>

要有这个的阿
如果你没有form就可以直接用alert(document.all("itemselect").selectedindex);
wenn_zh 2005-04-25
  • 打赏
  • 举报
回复

<select name="itemselect" id="iteminfo" size=1 onchange="displayinfo()">
<%int i=1
do while not itemrs.eof
%>
<option value=<%=itemrs("itemid")%> ><%=itemrs("itemname")%></option>
<%
itemrs.movenext
loop%>
</select>
wenn_zh 2005-04-25
  • 打赏
  • 举报
回复
没人会么?

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧