事件处理函数为啥不起作用?
下面代码中, 两个按纽分别是隐藏一个textarea 和 重新加载iframe内容。可是点击后,都没有响应,也不能调试(在VS2005)。请帮助看一下!
<html>
<head runat= "server ">
<title> </title>
<script language= 'javascript ' type= 'text/javascript '>
function btnmypage_click ( )
{
var iframe = document.getElementById( 'maincontent ');
iframe.src = 'mypage.aspx ';
iframe.location.reload();
return false;
}
</script>
</head>
<body>
<form id= "form1 " runat= "server ">
<asp:LinkButton runat= "server " ID= "btnlink " Text= "personalpage " OnClientClick = "btnmypage_click " />
<asp:button ID= "btn_search_body " runat=server OnclientClick= "btn_search_body_clicked " Text= "change "> </asp:button>
<textarea id= "txt_body " style= "width:200; height:500 "> </textarea>
<iframe id = "maincontent " src= "defaultcontent.aspx " scrolling= "no " title= "login " frameborder= "no "> </iframe>
</form>
<script language= 'javascript ' type= 'text/javascript '>
var btn_search_body_clicked=function ()
{
debugger;
var a = document.getElementById( "txt_body ");
a.style.display = "none ";
return false;
}
</script>
</body>
</html>
------解决方案--------------------OnClientClick = "btnmypage_click "
=>
OnClientClick = "btnmypage_click() "
是不是需要加括号呢?