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

时间:2022-08-08 19:57:46

原文:JS function document.onclick(){}报错Syntax error on token "function", delete this token - CSDN博客

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();
  }
}