為什么我的會(huì)顯示不出來(lái)呢
<!DOCTYPE?HTML> <html> <head> <meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8"> </head> <body> <script?type="text/javascript"> ????var?height=window.innerHeight; ????var?width=window.innerWidth; ????var?input=document.createElement("input"); ????input.type="button"; ????input.value="你好"; ????input.conclick="alerte()"; ????document.body.appendChild(input); ????function?alerte(){ ????????alert(height+"和"+width); ????} ?? </script> </body> </html>
2023-02-21
13行onclick寫(xiě)成了conclick
2021-04-22
input.conclick=
"alerte()"
;
這行用下面的代替input.onclick=alerte;
或者這樣也行input.setAttribute("onclick","alerte()");
具體的原因我也不知道orz,不知道怎么解釋