hide.js:5 Uncaught TypeError: Cannot read property 'style' of undefined

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title></title>

<script src="debug.js"></script>

<script src="hide.js"></script>

</head>

<body>

hello

<button  style="background: cornflowerblues;" onclick="hide(this.true);debug('hide button1');">hide1</button>

world

</body>

</html>

function hide(e,reflow){

if(reflow){

e.style.display='none';

}else{

e.style.visibility='hidden';

}

}

为什么会报这个错,怎么改??

kathria
浏览 1704回答 1
1回答

李晓健

onclick="hide(this,true)"多个参数是逗号分隔!
打开App,查看更多内容
随时随地看视频慕课网APP