嗨,这让我发疯了。我不是开发人员。试图让这个工作。用户使用日期对象(日历)将日期(雇用日期)输入表单 下一个字段应采用该日期并减去今天的日期以获得就业时间。但是我在该领域变得不确定,并且我原来的雇用日期消失了。这是我所拥有的,请帮助,非常感谢!
//grab date of hire
try{document.getElementById("dData_DOH").onchange = custom_calculateDate;}catch(e){}
//not sure if necessary - field that the difference should go to
try{document.getElementById("dData_LengthEmp").onblur = insertDate;}catch(e){}
//Function to grab input hire date
//Create variable for now
//Create variable for difference
function custom_calculateDate(){
var hireDate = document.getElementById("dData_DOH").value = "";
var timeNow= new Date();
var diff = Math.abs(timeNow - hireDate);
document.getElementById("dData_DOH").setAttribute('value', custom_calculateDate());
}
//Function to get the difference into the LengthEmp field
function insertDate() {
document.getElementById("dData_LengthEmp").setAttribute("", custom_calculateDate());
}
我知道这是完全错误的,因为我说过我不是开发人员或程序员,我无法弄清楚如何将这些信息放入该字段并让我的原始字段仍然显示。
谢谢您阅读此篇!