Javascript 如何基于另一个输入文本字段的特定值更改一个输入文本字段的值
我的HTML代码Javascript 如何基于另一个输入文本字段的特定值更改一个输入文本字段的值,javascript,html,jquery,jsp,Javascript,Html,Jquery,Jsp,我的HTML代码 订单号 订单金额 笔记 批准人 编辑 我的数据库: Field Type Collation Null Key Default Extra Privileges Comment --------------- ------------- --------------- ------ ------ ------- ------ ------
订单号
订单金额
笔记
批准人
编辑
我的数据库:
Field Type Collation Null Key Default Extra Privileges Comment
--------------- ------------- --------------- ------ ------ ------- ------ ------------------------------- ---------
Order_ID int (NULL) NO PRI (NULL) select,insert,update,references
Customer_Name varchar(100) utf8_general_ci YES (NULL) select,insert,update,references
Customer_ID int (NULL) YES (NULL) select,insert,update,references
Order_Amount int (NULL) YES (NULL) select,insert,update,references
Approval_Status varchar(100) utf8_general_ci YES (NULL) select,insert,update,references
Approved_By varchar(100) utf8_general_ci YES (NULL) select,insert,update,references
Notes varchar(1000) utf8_general_ci YES (NULL) select,insert,update,references
Order_Date datetime (NULL) YES (NULL) select,insert,update,references
我的问题是:如果我更改少于10000的订单金额,它将自动填充“David Lee”名称的Approved By字段。如何实现此功能?使用onchange调用javascript函数进行检查 (如果您输入20000作为订单金额,则不会有任何更改,但如果您将其更改为1234,即小于10000,则系统将使用David Lee作为批准人)
函数autopopulate(){
if(document.getElementById(“txtAMT”).value*1<10000)
{document.getElementById(“txtApp”).value=“David Lee”;
}
}
订单号
订单金额
笔记
批准人
编辑
使用onchange调用javascript函数检查
(如果您输入20000作为订单金额,则不会有任何更改,但如果您将其更改为1234,即小于10000,则系统将使用David Lee作为批准人)
函数autopopulate(){
if(document.getElementById(“txtAMT”).value*1<10000)
{document.getElementById(“txtApp”).value=“David Lee”;
}
}
订单号
订单金额
笔记
批准人
编辑
您能否与我们分享您迄今为止尝试的内容?需要在后端代码(即:db)中进行更改?您能否与我们分享您迄今为止尝试的内容?需要在后端代码(即:db)中进行更改?