// 功能:快速定位select中内容的方法 // 描述:当txt中的内容变化时,下拉框的内容跟着定位。比如当在input中录入a时,select中定位到第一个有a开头的元素。 // 该方法是为选择炉号、选择钢号、选择生产号三个select元素用的。 // 参数:selectName是select元素的名字,inputText是input中已经录入了的内容。 // 增加人:段忠琳 function txtOnChange(selectName,inputText) ... { if (selectName.selectedIndex!=-1)...{ selectName.options(selectName.selectedIndex).selected = false; } /**//*2005.07.12 梁志德 当selectName长度不固定时,短selectName的定位*/ for (i=0;i<selectName.options.length;i++)...{ if (selectName.options(i).text == inputText)...{ selectName.options(i).selected = true; return; } } for (i=0;i<selectName.options.length;i++)...{ if (selectName.options(i).text.indexOf(inputText)!=-1)...{ selectName.options(i).selected = true; return; } } } // 功能:当text得到焦点时,清空内容 // 描述:同上 // 参数:oText,触发该函数的text元素。 // 增加人:段忠琳 function txtOnfocus(oText) ... { oText.value=""; } 文本框使用 onkeyup事件