隐藏边框线的方法:1、使用“document.getelementbyid(id)”语法根据id值获取指定元素节点;2、使用“元素节点.style.bordercolor=transparent;”语句来隐藏指定元素节点的边框线。
本教程操作环境:windows7系统、javascript1.8.5版、dell g3电脑。
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学习教程】
以上就是javascript怎么隐藏边框线的详细内容。