<script language="javascript">
<!--
function updateContactOpts(userid){
Smalls=new Array();
<%
i=0
Cae="select * from Tcontacts where Userid="&Userid&" order by Cid"
Set Rce=Conn.Execute(Cae)
If Rce.eof and Rce.bof then
Response.Write "目前此公司没有联系人"
else
Do while not Rce.eof
Response.Write Vbcrlf&"Smalls["&i&"] =new Array('"&Rce("Cid")&"','"&Rce("Cname")&"');"
i=i+1
Rce.movenext
Loop
Rce.close
set Rce=nothing
end if
%>
var i;
document.form1.Cid.length=0 ;
document.form1.Cid.options[document.form1.Cid.length]=new Option("请选择联系人","");
for (i=0 ;i <Smalls.length;i++){
document.form1.Cid.options[document.form1.Cid.length]=new Option(Smalls[i][1],Smalls[i][1]);
}
}
-->
</script>
利用按钮触发这个updateContactOpts,然后得到一个下拉框, 上面的代码我文件打开就直接运行了(还没点击按钮),提示“语法错误 (操作符丢失) 在查询表达式 'Userid='”请问上面的代码如何修改,我的本意是想根据选择的公司的不同,得到这个公司对应的联系人下拉框。
<!--
function updateContactOpts(userid){
Smalls=new Array();
<%
i=0
Cae="select * from Tcontacts where Userid="&Userid&" order by Cid"
Set Rce=Conn.Execute(Cae)
If Rce.eof and Rce.bof then
Response.Write "目前此公司没有联系人"
else
Do while not Rce.eof
Response.Write Vbcrlf&"Smalls["&i&"] =new Array('"&Rce("Cid")&"','"&Rce("Cname")&"');"
i=i+1
Rce.movenext
Loop
Rce.close
set Rce=nothing
end if
%>
var i;
document.form1.Cid.length=0 ;
document.form1.Cid.options[document.form1.Cid.length]=new Option("请选择联系人","");
for (i=0 ;i <Smalls.length;i++){
document.form1.Cid.options[document.form1.Cid.length]=new Option(Smalls[i][1],Smalls[i][1]);
}
}
-->
</script>
利用按钮触发这个updateContactOpts,然后得到一个下拉框, 上面的代码我文件打开就直接运行了(还没点击按钮),提示“语法错误 (操作符丢失) 在查询表达式 'Userid='”请问上面的代码如何修改,我的本意是想根据选择的公司的不同,得到这个公司对应的联系人下拉框。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货