Image border 属性

定义和用法
border 属性可设置或者返回图片的 border 属性值。
border 属性指定了图像周围的边框宽度。
注意:默认情况下图片没有边框(除非图片本身自带了边框)。
语法
imageObject.border=pixels
浏览器支持
所有主要浏览器都支持 border 属性
实例
添加图片边框:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>蜜蜂教程(mifengjc.com)</title> <script> function addBorder() { document.getElementById("compman").border = "2"; } </script> </head> <body> <img id="compman" src="/examples/compman.gif" alt="Computerman" width="107" height="98"> <br><br> <input type="button" onclick="addBorder()" value="加上边框"> </body> </html>
