日期:2014-05-16 浏览次数:20405 次
<script type="text/javascript">
function selecttype(key){
ch = new Array;
ch = key.split(" ");
for(i=0;i<ch.length;i++){
alert(ch[i]);
}
}
</script>
<input name="input" onblur="selecttype(this.value)" type="text" />
<select name="multiple" multiple>
<option value="1">A</option>
<option value="2">B</option>
</select>
<script type="text/javascript">
function selecttype(key){
ch = new Array;
ch = key.split(" ");
var sel=document.getElementById('sel');
for(i=0;i<ch.length;i++){
// alert(ch[i]);
for(var j=0,len=sel.options.length;j<len;j++){
if(sel.options[j].text==ch[i]) sel.options[j].selected=true;
}
}
}
</script>
<input name="input" onblur="selecttype(this.value)" type="text" />
<select id="sel" name="multiple" multiple>
<option value="1">A</option>
<option value="2">B</option>
</select>