用户输入他们的出生日期,并且必须在15到80岁之间。
JavaScript: 我目前有 dob =出生日期
si = connect() # connect method connects to the standalone ESX host. It is NOT part of any VCenter
content = si.RetrieveContent()
# nfs_datastore = add_nfsdatastore(content, 'esx-ip', 'nfs-ip', 'nfs-path', 'nfs-name')
# print("nfs datastore added successfully")
# print(nfs_datastore)
host = content.rootFolder.childEntity[0]
host_folder = host.vmFolder
print(host_folder)
hostobj = content.searchIndex.FindByIp(None, "esx-ip",vmSearch=False)
host_folder.RegisterVM_Task("[nfs-datastore-name]/my-template/ubuntu-temp-1.vmtx", "automation-template-1", asTemplate=True, host=hostobj)
HTML :
var dob = document.getElementById("dob").value;
var minDate = new Date('04/30/1937');
var maxDate = new Date('04/30/2004');
if (dob < minDate) {
result = false;
errMsg = errMsg + "You are too old to be applying for this position/n"
} else if(dob > maxDate) {
result = false;
errMsg = errMsg + "You are too young to be applying for this position/n"
}
答案 0 :(得分:1)
代码中的所有内容都很不错。但您需要在parent
child2
值
child1