基本上我想在“numYear”输入我的出生日期,但它没有得到值。
这是我的代码:
function myAge() {
let myBirthYear = document.getElementById('numYear').Value;
let result = (2020 - myBirthYear);
//create h1 element
let h1 = document.createElement('h1');
let h1elem = document.createElement('class','newelem');
let answer = document.createTextNode('You are ' + result + ' years old!');
h1.appendChild(answer);
document.getElementById('results').appendChild(h1);
}
墨色风雨
相关分类