function sel(){
if(text1.value=="111")sel1.options[xxx].selected}再文本筐中对onChange 事件处理调用sel()
解决方案 »
- 校园网络社交平台的设计与实现
- 使用struts2的校验功能,居然弹出脚本错误
- ibatis查询条件设置问题
- org.hibernate.util.JDBCExceptionReporter
- 数据库连接池技术经典问题(请教高手,全分相送)
- 用jax-ws实现的webservice能被用jax-rpc创建的client访问么
- 关于会话
- jsp文件修改保存,重起tomcat以后为何在浏览器中刷新打开的仍然是修改前的页面结果呢?
- jsp中如何将css选择器设置为变量
- javabean的类文件放那里?
- 急:我想从硬盘上读取一个flash文件,然后通过输出流显示在网页上,内附程序源码:
- 如何把执行后的JSP文件动态内容保存为html文件?
sel1.options[xxx].selected=true;
是空白的,那具体该怎么做呢?能给个例子吗?
{
var val=val;
if (window.event.keyCode==13) //按回车键生成下拉表
if(val=="001")
{
document.all("select1").length=0; document.all("select1").options[document.all("select1").length]=new Option("人事科","1"); document.all("select1").options[document.all("select1").length]=new Option("财务科","2"); document.all("select1").options[document.all("select1").length]=new Option("生产科","3"); document.all("select1").focus();
}
}
</SCRIPT>
<input type="text" name="text1" onKeyPress="change(this.value)"> <!--响应事件--><select name="select1" >
</select>
optiong[1],optiong[2],......,optiong[n]
等等
<form name="form1" method="post" action="">
<input type="text" name="text1" onKeyUp="sel1();">
<select name="select1">
<option value="001">人事可</option>
<option value="002">财务科</option>
<option value="003">生产可</option>
</select>
</form>
<script language="JavaScript">
function sel1(){
if(form1.text1.value=="001")document.form1.select1.options[0].selected=true;
if(form1.text1.value=="002")document.form1.select1.options[1].selected=true;
if(form1.text1.value=="003")document.form1.select1.options[2].selected=true;
}
</script>