当前位置:网站首页>Oninput one function to control multiple oninputs (take the contents of this input box as parameters) [very practical, very practical]
Oninput one function to control multiple oninputs (take the contents of this input box as parameters) [very practical, very practical]
2022-04-23 17:11:00 【ZHZHK001】
effect
oninput Take the contents of this input box as a parameter , Take the input box of the operation object as the parameter
One function can control multiple functions oninput The effect of
Knowledge point
1. Function encapsulation , The ginseng
2.this Usage of
3.getAttribute Usage of
The effect is as shown in the picture

The key codes are as follows
<tr>
<td>ID1</td>
<td>
<input id="P_PID" oninput="gainPName(this,'NAME1')" />
</td>
<td> name 1</td>
<td>
<input id="NAME1" />
</td>
</tr>
<tr>
<td>ID2</td>
<td>
<input id="P_FID" oninput="gainPName(this,'NAME2')" />
</td>
<td> name 2</td>
<td>
<input id="NAME2" />
</td>
<td>ID3</td>
<td>
<input id="P_MID" oninput="gainPName(this,'NAME3')" />
</td>
<td> name 3</td>
<td>
<input id="NAME3" />
</td>
</tr>
/** * Get... In real time ID Personnel information , And change the value of the corresponding input box * @param input This input box * @param toNameID Of another input box ID */
function gainPName(input,toNameID){
// console.log(input); // Get the contents of this input box
// console.log(input.getAttribute("ID")); // Get the of this input box ID
// console.log( $("#"+input.getAttribute("ID") ).val() ); // Get the input content of this input box
$("#"+toNameID).val(" unregistered "); // Assign initial value to
var result = gainPersonById( $("#"+input.getAttribute("ID") ).val() );
if(result.length==0){
$("#"+toNameID).val(" unregistered ");
}else{
if(result.get("flag")){
$("#"+toNameID).val(result.get("rs").NAME);
}else{
$("#"+toNameID).val(" unregistered ");
}
}
}
版权声明
本文为[ZHZHK001]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230553251729.html
边栏推荐
- Go language RPC communication
- ASP. Net core dependency injection service life cycle
- _ Mold_ Board_
- Generation of barcode and QR code
- Paging SQL
- Use of Shell sort command
- freeCodeCamp----shape_ Calculator exercise
- El date picker limits the selection range from the current time to two months ago
- VLAN高级技术,VLAN聚合,超级Super VLAN ,Sub VLAN
- 2. Electron's HelloWorld
猜你喜欢

2. Electron's HelloWorld

groutine

线性代数感悟之1
![Customize my_ Strcpy and library strcpy [analog implementation of string related functions]](/img/71/a6a0c7b0e652d2b807f259f7cbf139.png)
Customize my_ Strcpy and library strcpy [analog implementation of string related functions]

. net type transfer

VLAN高级技术,VLAN聚合,超级Super VLAN ,Sub VLAN

Smart doc + Torna generate interface document

Deep understanding of control inversion and dependency injection

Change the password after installing MySQL in Linux

Milvus 2.0 質量保障系統詳解
随机推荐
自定义my_strcpy与库strcpy【模拟实现字符串相关函数】
【WPF绑定3】 ListView基础绑定和数据模板绑定
Variable length parameter__ VA_ ARGS__ Macro definitions for and logging
1-3 components and modules
TypeError: set_ figure_ params() got an unexpected keyword argument ‘figsize‘
[C#] 彻底搞明白深拷贝
JS, entries(), keys(), values(), some(), object Assign() traversal array usage
Clickhouse SQL operation
Perception of linear algebra 2
VsCode-Go
Calculation formula related to tolerance analysis
New keyword learning and summary
Detailed explanation of Milvus 2.0 quality assurance system
Nodejs installation and environment configuration
Clickhouse table engine
Summary of common websites
Use of shell cut command
基于51单片机红外无线通讯仿真
Freecodecamp ---- budget & category exercise
SQL database