编辑下面的代码:【加编码】
<html> <head> <style type="text/css"> div { border:1px solid red; width:100px; height:100px; } </style> <script> function displayResult() { document.getElementById("div1").style.overflow="hidden"; } </script> </head> <body> <div id="div1"> This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. </div> <br> <input type="button" onclick="displayResult()" value="Hide overflow"> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂