<script language=javascript>
function jj_onChange()
{
myval = document.frm.jj.value;
for (i=0;i<document.frm.bb.length;i++)
{
if(myval == document.frm.bb.options[i].value)
{
eval('document.frm.bb.options[i].selected=true;');
break;
}
}
return true;
}
</script>
</head>
<body bgcolor=#ffffff topmargin=5 marginheight=5>
<center>
<form name="frm">
<input class="textform1" type="text" name="jj" size="8" value="0">
<select name="bb" LANGUAGE="javascript">
<option value='1'>tt</option>
<option value='2'>aa</option>
</select>
<input type="button" value="判断" onclick="jj_onChange()">
</form>
</center>
</body></html>
function jj_onChange()
{
myval = document.frm.jj.value;
for (i=0;i<document.frm.bb.length;i++)
{
if(myval == document.frm.bb.options[i].value)
{
eval('document.frm.bb.options[i].selected=true;');
break;
}
}
return true;
}
</script>
</head>
<body bgcolor=#ffffff topmargin=5 marginheight=5>
<center>
<form name="frm">
<input class="textform1" type="text" name="jj" size="8" value="0">
<select name="bb" LANGUAGE="javascript">
<option value='1'>tt</option>
<option value='2'>aa</option>
</select>
<input type="button" value="判断" onclick="jj_onChange()">
</form>
</center>
</body></html>
解决方案 »
- 求助,关于javascript向数据库插入数据
- 这段代码有什么不兼容其他浏览器的地方吗
- 使用JS的FOR循环,如何动态生成这样的数组?
- 请教一下网页怎么直接调用本地的EXE程序
- 我来送分了 大家帮忙看一下哪里不对
- 紧急求助:一个多选列表框的内容,选中后,如何进入到,一个多行文本框内!!!!!!!!!!!!(工作中的实际问题!)
- js中异步请求的问题
- 想在不提交页面的情况下,对表格中的记录数据进行循环处理,可使用javascript速度很慢,有没有别的方式可以代替吗?
- 请教小问题!(在线等!)
- 关于window.showModalDialog的问题
- 请问如何判断Excel中当前已编辑了的区域?(在线等,马上结帐)
- 今天有个重大发现!
<select name="bb">
<option value='11'>t1</option>
<option value='2'>abc</option>
</select>
<input type=button onclick="checkvalue()" value="Check">
<script>
function checkvalue() {
var inputvalue=document.all.jj.value;
var getvalue=document.all.bb.options;
for(i=0;i<getvalue.length;i++) {
if(getvalue(i).innerText==inputvalue)
getvalue(i).selected=true;
}
}
</script>