When the following statement is called when the page has not been loaded, the "add" object cannot be obtained, and the prompt is empty or not an object
document.getElementById("add").onclick = function(){
alert("hello");
}
Objects that are available when used
window. onload = function(){
document.getElementById("add").onclick = function(){
alert("hello");
}
}