问题描述
问候,
我希望在文本框中替换从数据库中检索的值以进行数据更新。但是,我的代码无法正常工作,我不知道原因。有人可以帮我看一下吗?非常感谢你的帮助。
我的尝试:
< label for =Emp_Typeclass =col-sm-2 col-sm-push-1 control-label>员工类型< span> *< / span> < /标签>
< div class =col-sm-2style =padding-left:8%; width:250px>
< select class = form-controlname =typeid =typeonChange =changetextbox()/>
< / select>
< / div>
< input type =textclass =form-controlstyle =width:120px; padding-left:1%id =pay name =payvalue =<?php echo $ payType?> readonly required>
function changetextbox()
{
if( document.getElementById(type)。value ===Full Time)
{
//替换付款类型的价值
var str = document.getElementById(pay)。value =;
var res = str.replace(,每小时);
document.getElementById(pay)。value = res;
}
}
Greetings,
I wish to replace the value retrieve from database in a textbox for data update. However, my codes cannot work properly and I don't know the reason. Can some one help me to look on it? Appreciate the help very much.
What I have tried:
<label for="Emp_Type" class="col-sm-2 col-sm-push-1 control-label">Employee Type <span> * </span> </label>
<div class="col-sm-2" style="padding-left:8%;width:250px">
<select class="form-control" name="type" id="type" onChange="changetextbox()"/>
</select>
</div>
<input type="text" class="form-control" style="width:120px;padding-left:1%" id="pay" name="pay" value="<?php echo $payType?>" readonly required>
function changetextbox()
{
if (document.getElementById("type").value === "Full Time")
{
//replace value of Pay Type
var str = document.getElementById("pay").value = "";
var res = str.replace("", "Hourly");
document.getElementById("pay").value = res;
}
}
推荐答案
这篇关于如何替换从数据库检索的文本框中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!