在文本框一中输入数字,在文本框二中就显示相对应的内容,
比如先定义好数组
a1(1,杭州)
a2(2,浙江)
a3(3,温州)我在文本框一中输入 1 ,鼠标离开时 文本框二中就显示 杭州 ,
比如先定义好数组
a1(1,杭州)
a2(2,浙江)
a3(3,温州)我在文本框一中输入 1 ,鼠标离开时 文本框二中就显示 杭州 ,
解决方案 »
- js替换问题
- 继续Doodle收集:粘土动画大师阿特·克洛基纪念Doodle
- 高分求教EXTJS如何把array数据换成json数据
- 如何用JQuery获取当前按钮,按下显示后面的文字
- 简单问题,遮盖层出来后,出来的对话框界面定位不了..
- javascript为什么无法识别xml文件的变化
- [50在线等谢谢]在js 中怎么获得text中所输入的信息占有的字节byte
- 怎么用javaScript 保存框架中的某个页面? 高分请教
- 如何模拟在控件上的双击操作?即双击的方法
- 关于变量得问题,好像有点问题
- 大家帮忙看下,这个javascript正则的作用是什么?
- jquery datepicker 可也设置宽度吗?救命啊,有哪位能帮帮忙?
<script type="text/javascript">
var arr={1:'杭州',2:'浙江',3:'温州'};
window.onload=function(){
document.getElementById("t1").onblur=function(){
var t=this.value;
for (var i in arr)
{
if(t==i)document.getElementById('t2').value=arr[i];
}
}
}</script>
<input type="text" id="t1">
<input type="text" id="t2">这样不知道是否OK。当文本框1失去焦点,2立刻显示对应的文字!
Citys = new Array(); <%
dim rs11,sql,i
sql = "select * from dev_xinghao"
set rs11 = Conn.execute(sql)
i = 0
while not rs11.eof
%>
Citys[<%=i%>] =new Array("<%=rs11("did")%>","<%=rs11("dxinghao")%>"); <%
i = i + 1
rs11.movenext
wend
rs11.close
set rs11 = nothing
%>
我想数组内容从数据库里读出来,这样可以?
这样的格式?
Citys=new Array();
<%
dim rs11,sql
sql = "select * from dev_xinghao"
set rs11 = Conn.execute(sql)
i = 0
while not rs11.eof
%>
Citys[<%=i%>] =new Array("<%=rs11("did")%>","<%=rs11("dxinghao")%>");
<%
i = i + 1
rs11.movenext
wend
rs11.close
set rs11 = nothing
%>
function changelocation(locationid){
var locationid=locationid;
var ii;
ii=<%=i%>
for (j=0;j < ii; j++){
if (Citys[j][0] == locationid){
document.form1.Popedom.value=Citys[j][1]
}
}
}
</script>
<input type="text" name="Popedom11" onChange="changelocation(this.value)" >
<input type="text" name="Popedom"> 已解决,谢谢各位