新手请教:javascript怎么能使下拉框的某一项被选中

ssd 2002-02-01 11:50:12
function be_change(thisform) //thisform=formname

....
if (thisform.dept.options.value="asd")
{
thisform.dept.options.selected=true;
}
.....
...全文
101 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
lihaitaoami 2002-02-01
  • 打赏
  • 举报
回复
java脚本里可以这么写。
if (thisform.dept.options[i].value="asd")
{
thisform.dept.options[i].selected=true;
}
vb脚本里可以这么写:
thisform.dept.value="asd"
就可以设置选中当前项了。
sdtashenjie 2002-02-01
  • 打赏
  • 举报
回复
Try it:
thisform.dept.options.selectedIndex = n;

希偌 2002-02-01
  • 打赏
  • 举报
回复
if (thisform.dept.options.value="asd")
{
thisform.dept.options[0].selected=true;
}

28,391

社区成员

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

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