各位高手各路英雄,帮我看看这两段代码如何整和,万分感谢!!
是这样的,下面这段代码功能是鼠标在SELECT框焦点上的时候可以快速检索SELECT下的内容:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<title> new document </title>
<meta name= "generator " content= "editplus " />
<meta name= "author " content= " " />
<meta name= "keywords " content= " " />
<meta name= "description " content= " " />
</head>
<body>
<h3> 仅以省为示例,纯 JS 实现,市、县思路完全一致。只需对三级联动略作修改即可使用 </h3>
<h3> 需要注意的是:回发数据中必须有 initial 一列,用于筛选。注:必须保证英文输入法状态 </h3>
<select id= "selProvince ">
<option value= "-1 "> --请选择 省-- </option>
<option value= "1 " intial= "b "> 北京市 </option>
<option value= "2 " intial= "s "> 上海市 </option>
<option value= "3 " intial= "t "> 天津市 </option>
<option value= "4 " intial= "c "> 重庆市 </option>
<option value= "5 " intial= "h "> 河北省 </option>
<option value= "6 " intial= "h "> 河南省 </option>
<option value= "7 " intial= "s "> 山东省 </option>
<option value= "8 " intial= "s "> 山西省 </option>
<option value= "8 " intial= "h "> 黑龙江省 </option>
</select>
<script type= "text/javascript ">
<!--
var oProvince = document.getElementById( "selProvince ");
var arrProvinces = new Array();
var optProvice;
// 保存省信息至对象数组
for (var i=0; i <oProvince.options.length; i++)
{
optProvice = oProvince.options;
arrProvinces = {valueptProvice.value, intialptProvice.intial, textptProvice.text};
}
oProvince.onmouseover = function ()
{
this.focus();
};
oProvince.onkeypress = function ()
{
var strInitial = String.fromCharCo