转自:http://hi.baidu.com/ÎÄÐĵñÁú113/blog/item/c558ce51be728a030df3e375.html
例://任意点击时关闭该控件
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下的函数时出错,经过百度,查阅原因是Myeclipse中的js的方法定义都是按照以下的形式:
方法返回类型 . 方法名称 =function(){ .............}