<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>Document</title></head><body> <p onclick="p();">我是P標(biāo)簽</p> <button onclick="btn();">我是button</button></body><script type="text/javascript"> function p(){ var p = document.getElementsByTagName('p'); console.log(p); p.style.display="none"; } btn=function(){ var btn = document,getElementsByTagName('button'); console.log(btn); btn.style.display="none"; }</script></html>p和btn都找不到。報(bào)錯(cuò):Uncaught ReferenceError: btn is not defined at HTMLButtonElement.onclick萌新實(shí)在沒有找出問題 才來提問。希望有大佬幫我看一下
onclick報(bào)錯(cuò): 函數(shù)未定義 萌新實(shí)在不知道錯(cuò)在哪
aluckdog
2018-10-03 06:47:50