JavaScript怎么隐藏边框线
JavaScript怎么隐藏边框线
在JavaScript中,可以通过将边框线的颜色设置为透明(transparent)来隐藏边框线。
实现代码:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style type="text/css"> div{ padding: 10px; background-color: #FFC0CB; border: 2px solid black; } </style> </head> <body> <div id="box">元素内容</div><br/> <button onclick="myFunction()">隐藏边框线</button> <script> function myFunction() { var box=document.getElementById("box"); box.style.borderColor="transparent"; } </script> </body> </html>
【相关推荐:javascript学习教程】