JS function document.onclick(){}报错Syntax error on token "function", delete this token

JS function document.onclick(){}报错Syntax error on token "function", delete this token


function document.onclick() //任意点击时关闭该控件 //ie6的情况可以由下面的切换焦点处理代替


  with(window.event)
  { if (srcElement != outObject && srcElement != outButton)
    closeLayer();
  }

}

更改为:

document.onclick()=function() //任意点击时关闭该控件 //ie6的情况可以由下面的切换焦点处理代替

  with(window.event)
  { if (srcElement != outObject && srcElement != outButton)
    closeLayer();
  }
}



你可能感兴趣的:(JS function document.onclick(){}报错Syntax error on token "function", delete this token)