改变HTML样式 document.getElementByld(id).style.property=new style <IDOCTYPE html> <html> <body> <pid="p1">这是一段文本。<p> <input type="button'"value="隐藏文本" onclick="document.getElementByld('p1).style.visibility='hidden/> <input type="button"value="显示文本" onclick="document.getElementByld(p1).style.visibility='visible""/> </body> </html>改变 HTML 样式 ▪document.getElementById(id).style.property=new style <!DOCTYPE html> <html> <body> <p id="p1">这是一段文本。</p> <input type="button" value="隐藏文本" onclick="document.getElementById('p1').style.visibility='hidden'" /> <input type="button" value="显示文本" onclick="document.getElementById('p1').style.visibility='visible'" /> </body> </html>