传参-this的使用
2018-04-16 22:31 yelena 阅读(279) 评论(0) 编辑 收藏 举报<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style type="text/css"> .one{ background-color: lightcyan; width: 80px; height: 30px; border: 1px solid lightcyan; float: left; padding-bottom: 20px; margin: 5px; text-align: center; line-height: 30px; } .one:hover{ cursor: pointer; } .two{ background-color: blue; width: 1000px; } </style> </head> <body> <div id=""> <div class="one" onmouseover="aa(this)">栏目一</div> <div class="one" onmouseover="aa(this)">栏目二</div> <div class="one" onmouseover="aa(this)">栏目三</div> <div class="one" onmouseover="aa(this)">栏目四</div> <br /> <br /> <br /> <div class="two"> </div> </div> </body> </html> <script type="text/javascript"> function aa(a){ var two = document.getElementsByClassName("two")[0]; two.innerHTML = ""; for(var i = 0;i < 4; i++){ two.innerHTML += a.innerHTML + "的内容<br/>"; } } </script>