a_cmb()更新一点问题都没有,下拉列表框里的内容全部更新了,只是显示的不是传入的那个学生的名字
解决方案 »
- 求助~~JavaScript的字符串中取特定的子串
- 我想拿到下拉框中所有的name,也就是一个页面有多少个select就拿到多少的select <select id=""><option>list</option></select>
- 字符串转换成对象
- 页面控制大小、工具条、地址栏等
- 关于FileSystemObject对象读取文件问题!
- kindeditor插件的问题
- 学习.net一段时间,写了一个聊天室,注册用户可以管理好友!欢迎大家测试。
- innerHTML不是向页面写HTML吗?我记得有个函数可以控制信息流可以在下一行输出新信息的?
- 各位大哥救火啊!!!!怎样得到iframe中src页面中table的clientHeight?
- 请问如何用Javascript来获取指定页面源代码?高手求救!
- Number 转 String 问题
- 怎么用javascript将数据打印到固定位置
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head><body style="text-align:center; ">
<Script language="javascript">
function checkStu(){
var inputValue=parseInt(document.getElementById("stuid").value);
var stuSel=document.getElementById("sel");
//var testResult=false;for(var i=0;i<stuSel.length;i++){
if(inputValue==stuSel.options[i].value){
stuSel.selectedIndex=i;
// testResult=true;
return;
}
}
stuSel.options.add(new Option(inputValue,inputValue.toString()));
stuSel.selectedIndex=stuSel.length-1;
}
</Script>
<select id="sel">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select><input type="text" id='stuid'>
<input type="button" onClick="checkStu()">
</body>
</html>
if (stuid== dl.options[i].value){
dl.value=stuid;
return i;
}
} 黄色代码的 return i 运行,程序的控制权就交换给调用他的函数了。
a_cmb("../lst?tab=stuid&id="+stuid,"stu");
for (var i=0,len=dl.options.length;i<len;i++) {
alert(dl.options[i].value+"bbb");
if (stuid==dl.options[i].value){
dl.selectedIndex=i;//dl.value=stuid;
return i;
}
}
alert(dl.value+"aaa");
return -1;
}
var isRun=false;
function newStuid(stuid){
var dl = document.getElementById('stu');
var old=dl.value;
var i = 0;
for (i=0,len = dl.options.length; i < len; i++) {
if (stuid== dl.options[i].value){
dl.selectedIndex=i;//dl.value=stuid;
return i;
}
}
if(isRun==true){isRun=false;return 0;}
isRun=true;
a_cmb("../lst?tab=stuid&id="+stuid,"stu");
setTimeout("newStuid("+stuid+")",22);
}
var isRun=false;
function newStuid(stuid){
var dl = document.getElementById('stu');
var old=dl.value;
var i = 0;
for (i=0,len = dl.options.length; i < len; i++) {
if (stuid== dl.options[i].value){
dl.selectedIndex=i; isRun=false;
return i;
}
}
if(isRun==true){isRun=false;return 0;}
isRun=true;
a_cmb("../lst?tab=stuid&id="+stuid,"stu");
setTimeout("newStuid("+stuid+")",70);
}