我想用参数制作函数。我使用下面的代码,但它不工作。谁能告诉我我做错了什么。
<head>
<script type="text/javascript" src="jquery-1.7.2.js"></script>
<script type="text/javascript">
$(function hide(fn){
$(fn).click(function(){
$('div').hide()
})
})
</script>
<style>
div { width:500px; height:500px; background:#FF0000; }
</style>
</head>
<body>
<button onclick="hide(this)">click for hide</button>
<a href="#">click</a>
<button>click</button>
<div></div>
</body>