日期:2014-05-16 浏览次数:20356 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <title>JS+CSS给图片加上鼠标滑过的方框</title> <style> .borderimage{ border:5px solid #ffffff; } </style> <script language="JavaScript"> function borderit(which,color){ //if IE 4+ or NS 6+ if (document.all||document.getElementById){ which.style.borderColor=color } } </script> <> <img src="http://pic10.nipic.com/20100926/2874022_122448725818_2.jpg" class="borderimage" onMousedown="borderit(this,'#1c1c1c')" onMouseup="borderit(this,'white')"> </div> </html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <title>JS+CSS给图片加上鼠标滑过的方框</title> <style> .borderimage { border: 5px solid #ffffff; } </style> <script language="JavaScript"> var v; function borderit(which, color) { //if IE 4+ or NS 6+ if (document.all || document.getElementById) { which.style.borderColor = color; } } function _borderit(which, color) { return function () { borderit(which, color); } } function myfunction(which, color) { v = setTimeout(_borderit(which,color), 1000); }; function stopfunction(which, color) { clearTimeout(v); borderit(which, color); } </script> <div> <img src="http://pic10.nipic.com/20100926/2874022_122448725818_2.jpg" class="borderimage" onmousedown="myfunction(this,'#1c1c1c')" onmouseup="stopfunction(this,'white')"> </div> </html>