js document报missing ( before function parameters

例://任意点击时关闭该控件
function document.onclick(){
  with(window.event.srcElement){
     if (tagName != "INPUT" && getAttribute("Author") != "tiannet")
         tiannetHideControl();
  }
}
这样会报missing ( before function parameters。
正确写法:
document.onclick=function(){
  with(window.event.srcElement){
     if (tagName != "INPUT" && getAttribute("Author") != "tiannet")
         tiannetHideControl();
  }
}

你可能感兴趣的:(js)