多行触发

      所有数据均为数据库循环读出.
请帮忙写段JS,通过选择姓名,将姓名里面的值 分割后,分别触发显示在电话,传真和EMAIL框中. 
     

<script>
function getText(val,id){
   
var array = val.split("|");
    document.all(
"tel"+id).value=array[0];
    document.all(
"fax"+id).value=array[0];
    document.all(
"email"+id).value=array[0];
}
</script>
<form name="myform">

<table border="1" width="454" height="198">
   
<tr>
       
<td height="28" width="55">姓名</td>
       
<td height="28" width="129">电话</td>
       
<td height="28" width="112">传真</td>
       
<td height="28" width="126">EMAIL</td>
   
</tr>
   
<tr>
       
<td height="56" width="55">
<select id="1" size="1" onchange ="getText(this.value,this.id)" >
<option value="020-1234567|020-7654321|abc@aa.com">小王</option>
<option value="021-1234567|021-7654321|abc@bb.com">小红</option>
<option value="022-1234567|020-7654321|abc@bb.com">apple</option>
<option value="023-1234567|021-7654321|abc@dd.com">mango</option>
</select>

       
</td>
       
<td height="56" width="129">
       
<input type="text" name="tel1" size="16" ></td>
       
<td height="56" width="112">
       
<input type="text" name="fax1" size="16" ></td>
       
<td height="56" width="126">
       
<input type="text" name="email1" size="16" ></td>
   
</tr>
   
<tr>
       
<td height="48" width="55">
<select id="2"  size="1" onchange ="getText(this.value,this.id)" >
<option value="030-1234567|030-7654321|bbc@ba.com">AA</option>
<option value="031-1234567|031-7654321|bbc@ba.com">BB</option>
<option value="032-1234567|030-7654321|bbc@ba.com">CC</option>
<option value="033-1234567|031-7654321|bbc@ba.com">mango</option>

</select></td>
       
<td height="48" width="129">
       
<input type="text" name="tel2" size="16" ></td>
       
<td height="48" width="112">
       
<input type="text" name="fax2" size="16" ></td>
       
<td height="48" width="126">
       
<input type="text" name="email2" size="16" ></td>
   
</tr>
   
<tr>
       
<td height="53" width="55">
<select id="3"  size="1" onchange ="getText(this.value,this.id)">
<option value="040-1234567|040-7654321|cbc@ca.com">FF</option>
<option value="041-1234567|041-7654321|cbc@ca.com">GG</option>
<option value="042-1234567|040-7654321|cbc@ca.com">aHH</option>
<option value="043-1234567|041-7654321|cbc@ca.com">OO</option>
</select></td>
       
<td height="53" width="129">
       
<input type="text" name="tel3" size="16" ></td>
       
<td height="53" width="112">
       
<input type="text" name="fax3" size="16" ></td>
       
<td height="53" width="126">
       
<input type="text" name="email3" size="16" ></td>
   
</tr>
</table>
<p>由数据库读出,循环.</p>
</form>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值