演示js中的事件

来源:互联网 发布:淘宝化妆品类目规则 编辑:程序博客网 时间:2024/06/03 17:09
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html>   <head>       <title>演示js中的事件 </title>   <script type="text/javascript">/*js中的事件:*/var big = true;function bigger(obj){var size = parseInt(obj.style.fontSize);if(size){//obj.style.fontSize = size+"px";if(size>=30){big =  false;}if(size<=10){big = true;}if(big){size += 2;}else{size -= 2;}obj.style.fontSize = size+"px";}else{obj.style.fontSize = "18px";}}</script>   </head>      <body><div onclick="bigger(this)">点击变大</div>   </body></html>

0 0